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() and finally translateYBy() vs yBy().
Can someone tell me the difference between these methods?
The documentation states that X
and Y
properties are absolute positions, while translationX
and translationY
are referred to the LEFT and TOP properties respectively.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With