<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"]/>
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"]
Some of the values make sense "fade", "rotation", "alpha"
But what about others like 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..
**
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
**
I am following this Tutorial and was trying to play with properties so as to have better understanding.
For say below attached screenshot shows so many possibilities for propertyName
but I dont know how they make sense.
More Over propertyName
accepts "x" and "y" as it values but they don't come in the window.
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..
This is what is explained in Google docs
NOTE:- I am trying animation for the first time not only with android but in my life too...
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.
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
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.
You can look at this page for more information: http://developer.android.com/guide/topics/graphics/prop-animation.html#object-animator
for honeycomb and above the available ones (according to this website) are:
- translationX
- translationY
- rotation
- rotationX
- rotationY
- scaleX
- scaleY
- pivotX
- pivotY
- x
- y
- alpha
as mentioned, you can also create your own properties, using get&set . i wonder if the new android versions have more properties built in.
you can also test them out in the API demos , in nineOldAndroids library , and on one of samsung samples.
来源:https://stackoverflow.com/questions/17295410/android-property-animation