ViewPropertyAnimator的translateYBy()和yBy()方法之间有什么区别? [英] What is the difference between ViewPropertyAnimator's translateYBy() vs yBy() methods?
问题描述
ViewPropertyAnimators( http://developer.android.com/reference/android/view/ViewPropertyAnimator.html )有两种移动视图的方法:
ViewPropertyAnimators (http://developer.android.com/reference/android/view/ViewPropertyAnimator.html) have two types of methods to move Views around:
translateX()vs x(),translateY()vs y(),translateXBy()vs xBy(),最后是translateYBy()与yBy()。
translateX() vs x(), translateY() vs y(), translateXBy() vs xBy() and finally translateYBy() vs yBy().
有人可以告诉我这些方法之间的区别吗?
Can someone tell me the difference between these methods?
推荐答案
该文档指出 X
和 Y
属性是绝对位置,而 translationX
和 translationY
分别称为LEFT和TOP属性。
The documentation states that X
and Y
properties are absolute positions, while translationX
and translationY
are referred to the LEFT and TOP properties respectively.
因此, animate()。x()
和 animate()。translationX()
是一个动画到绝对值,而其他动画设置为绝对值,但由视图 LEFT
和 TOP
值确定。
So, the difference between animate().x()
and animate().translationX()
is that one animates to an absolute value, while the other animates to a still absolute value but determined by the view LEFT
and TOP
values.
相比之下, animate()。xBy()
和 animate()。translationXBy()
将属性值(按代数方式)增加指定的数量。
By contrast, animate().xBy()
and animate().translationXBy()
increase (algebraically) the property value by the specified amount.
这是上面引用的某些数学的起源。
That is the origin of the "some mathematics" cited above.
这篇关于ViewPropertyAnimator的translateYBy()和yBy()方法之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!