android - How to use StateListAnimator? -


from docs:

the new statelistanimator class lets define animators run when state of view changes. following example shows how define statelistanimator xml resource:

<!-- animate translationz property of view when pressed --> <selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:state_pressed="true">     <set>       <objectanimator android:propertyname="translationz"         android:duration="100"         android:valueto="2"         android:valuetype="floattype"/>         <!-- have other objectanimator elements              here "x" , "y", or other properties -->     </set>      </item>      <item android:state_enabled="true"     android:state_pressed="false"     android:state_focused="true">     <set>       <objectanimator android:propertyname="translationz"         android:duration="100"         android:valueto="2"         android:valuetype="floattype"/>     </set>    </item>  </selector> 

however, says nothing how use xml file. there seems no method on resources class statelistanimator, , statelistanimator class not provide info either.

how can use this?

in android l new xml attribute has been added view :

android:statelistanimator   : sets state-based animator view. 

additionally instantiating statelistanimator object programmatically new method :

loadstatelistanimator(context context, int id) 

has been added animatorinflater .

these can found on android l developer preview documentation package.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -