Android的属性动画 [英] Android Property Animation
问题描述
<objectAnimator
android:propertyName="string"
android:duration="int"
android:valueFrom="float | int | color"
android:valueTo="float | int | color"
android:startOffset="int"
android:repeatCount="int"
android:repeatMode=["repeat" | "reverse"]
android:valueType=["intType" | "floatType"]/>
好吧,我正在学习在Android的一些动画。我从那个其实我不能够理解的谷歌开发者文档的两个属性得到它
Ok I am learning some Animation in android. I got it from Google Developer Docs two attributes that actually I am not able to understand are
android:propertyName="string"
android:valueType=["intType" | "floatType"]
某些值的意义变脸,旋转,阿尔法
但对于其他像 endYear,firstDayOfWeek
和我没有找到关于这些的任何详细的文档,或可能有机会,我不理解什么各种教程和谷歌文件试图传达..
And I failed to find any detailed documentation about these or there may be chances that I am not understanding what various tutorials and Google Docs trying to convey..
**
我的疑问是从那里我能得到的所有可能值
propertyName的
什么是值类型
我的意思是它实际上做
它究竟如何影响动画
My doubt is from where I can get all possible values of
"propertyName"
And what is"valueType"
I mean what actually it do how actually it affect the animation
**
我下面<一href="http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-a-simple-property-animation/"相对=nofollow>这个教程,并试图与性能发挥这样才能有更好的理解。
I am following this Tutorial and was trying to play with properties so as to have better understanding.
有关附在下面的截图说显示如此多的可能性为 propertyName的
,但我不知道他们是怎么做的感觉。
For say below attached screenshot shows so many possibilities for propertyName
but I dont know how they make sense.
越飞越 propertyName的
接受X和Y,因为它的价值观,但他们不来在窗口中。
More Over propertyName
accepts "x" and "y" as it values but they don't come in the window.
在的情况下值类型
如果我改变floatType
到IntType上的
在本教程的下面提及代码片段轮
In case of ValueType
if I change "floatType"
to "intType"
in the below mention snippet of the tutorial for wheel
<objectAnimator
android:duration="3000"
android:propertyName="rotation"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:valueTo="180"
android:valueType="floatType" />
它停止动画.. ??????
It stops animating..??????
任何一个可以解释这个问题,或者源,从而,我自己看着办吧。
Can Any one explain this issue or a source so as that I can figure it out..
这是在<一个解释href="http://developer.android.com/reference/android/animation/ObjectAnimator.html#setPropertyName%28java.lang.String%29"相对=nofollow>谷歌文档
注意: - 我想动画的第一次,不仅与Android,但在我的生活太...
NOTE:- I am trying animation for the first time not only with android but in my life too...
推荐答案
在 propertyName的
参数可以是动画目标的类定义的任何财产。举例来说,如果你制作动画的对象提供了一个的getFoo()
和 setFoo()
方法,那么有是foo的属性,你可以设置动画。
The propertyName
parameter can be any property defined by the animation target's class. For instance, if the object you're animating offer a getFoo()
and a setFoo()
method, then there is a "foo" property you can animate.
有一个很简单的例子是查看的 getAlpha()
和 setAlpha()
的方法。他们一起定义的阿尔法
属性,您可以动画创建淡入淡出效果
A very simple example is View's getAlpha()
and setAlpha()
methods. They defined together the "alpha"
property that you can animate to create fading effects
这也意味着你可以在你的自定义视图创建自己的属性。所有你需要做的是建立两个公共方法:一个getter和一个setter
This also means you can create your own properties in your custom views. All you need to do is create two public methods: a getter and a setter.
您可以看一下这个页面了解更多信息:的http://developer.android.com/guide/topics/graphics/prop-animation.html#object-animator
You can look at this page for more information: http://developer.android.com/guide/topics/graphics/prop-animation.html#object-animator
这篇关于Android的属性动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!