如何在java代码中设置"toYDelta"属性?

Moh*_*sen 2 xml android android-animation

我在textView他们每个人身上都有很多人,tableLayout而且visibility.GONE在一开始就有.我正在尝试扩展tableLayout属于a的textView时候textView点击它.我已经alphatableLayouts和translate动画分配了动画,这些动画textView在被点击的动画下方.

由于我的大小tableLayout不同,我必须 在新动画中单独设置toYDeltafromYDelta分别点击textView!我认为这是完全难的代码!!!

我的问题是:有没有任何方法可以用它来toYDelta编程修改may代码?

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

mat*_*ash 5

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

view.animate().translationY(value);
Run Code Online (Sandbox Code Playgroud)

要获取当前值(例如,如果要使用固定偏移量更新它),您可以使用view.getTranslationY().

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