ViewPropertyAnimator的translateYBy()和yBy()方法之间有什么区别? [英] What is the difference between ViewPropertyAnimator's translateYBy() vs yBy() methods?

查看:532
本文介绍了ViewPropertyAnimator的translateYBy()和yBy()方法之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

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