如何设置" toYDelta"在java中code属性? [英] How to set "toYDelta" attribute in java code?

查看:237
本文介绍了如何设置" toYDelta"在java中code属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多的TextView 和下面的每个人,一个 tableLayout visibility.GONE 在开始的时候。
我试图展开 tableLayout 这是属于的TextView 的TextView 点击。我已经指派字母动画 tableLayout 翻译动画的的TextView 是被点击以下任一。

I've got many textViews and below each of them, a tableLayout which has visibility.GONE at the very beginning . I am trying to expand the tableLayout which is belong to a textView when the textView is clicked . I've assigned alpha animation to tableLayouts and translate animation to those textViews are below the clicked one .

由于大小我的 tableLayout 是不同的我必须设置 toYDelta fromYDelta
分别为每点击的TextView 一个新的动画!
我认为这完全是很难code!

since the size of my tableLayout are different I have to set toYDelta and fromYDelta separately in a new animation for clicking every textView !! and I think it is totally hard code !!!

我的问题是:有没有我可以用它来修改任何方法 toYDelta 5月code编程

My question is : Is there any method I can use it to modify toYDelta in may code programmatically ?

或任何人可以帮助我其他的方式来做到这一点吗?

Or can anyone help me other way to do that please ?

推荐答案

有这样做的几种选择。最简单的可能就是使用 ViewPropertyAnimator ,例如

There are several alternatives for doing this. The simplest one is probably to use a ViewPropertyAnimator, e.g.

view.animate().translationY(value);

要获取的当前值(例如,如果你想用一个固定偏移更新它),你可以使用的 view.getTranslationY()

To get the current value (for example if you want to update it with a fixed offset) you can use view.getTranslationY().

请参阅 http://developer.android.com/guide/topics /graphics/prop-animation.html

这篇关于如何设置" toYDelta"在java中code属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆