Android L "delightful" drawable transformations -
does google allow icon transitions such these created developer? or developers responsibility create such "delightful" transitions? i'd implement these in app.
you can create animated icon using animateddrawable , bitmap-based frames. on l, can use animatedstatelistdrawable create stateful animations (such check box animation).
here animateddrawable example (actually implementation check box on l preview) using 15ms-long frames can started , stopped code:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:duration="15" android:drawable="@drawable/my_icon_frame_000" /> ...additional frames... </animation-list> and here animatedstatelistdrawable using animateddrawable transitions implement check box animation starts , stops automatically based on view state:
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_checked="true"> <bitmap android:src="@drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorcontrolactivated" android:alpha="?attr/disabledalpha" /> </item> <item android:state_enabled="false"> <bitmap android:src="@drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorcontrolnormal" android:alpha="?attr/disabledalpha" /> </item> <item android:state_checked="true" android:id="@+id/on"> <bitmap android:src="@drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorcontrolactivated" /> </item> <item android:id="@+id/off"> <bitmap android:src="@drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorcontrolnormal" /> </item> <transition android:fromid="@+id/off" android:toid="@+id/on"> <animation-list> <item android:duration="15"> <bitmap android:src="@drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorcontrolnormal" /> </item> ...additional frames... </animation-list> </transition> <transition android:fromid="@+id/on" android:toid="@+id/off"> <animation-list> <item android:duration="15"> <bitmap android:src="@drawable/btn_check_to_off_mtrl_000" android:tint="?attr/colorcontrolactivated" /> </item> ...additional frames... </animation-list> </transition> </animated-selector>
Comments
Post a Comment