android - ImageButton animation not applied to all states -
i have imagebutton image rotates device orientation image/ button horizontal (note rotations handled manually, not through activity life-cycle).
this works great, except when user presses button (state pressed), 90' rotation lost temporarily.
button animation;
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="0" android:todegrees="-90" android:pivotx="50%" android:pivoty="50%" android:duration="200" android:fillafter="true"> </rotate>
the image button drawable;
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/btn_go_back_pressed" /> <item android:state_enabled="false" android:drawable="@drawable/btn_go_back_disabled" /> <item android:drawable="@drawable/btn_go_back_normal" /> </selector>
loading animation;
animationutils.loadanimation(mcontext, r.anim.button_rotate90);
and when device orientation changes;
case messageque.set_to_portrait: inportrait = true; (view ib : buttonstoanimate) { if (ib instanceof textview) { ib.startanimation(cntportraitanim); } else { ib.startanimation(btnportraitanim); } }
does have ideas on why, , more importantly, how fix it?
excellent pointer whitney - solved visibility issues having well. above code has been replaced with;
case messageque.set_to_landscape: (view ib : buttonstoanimate) ib.animate().rotation(0).setduration(200); break; case messageque.set_to_portrait: (view ib : buttonstoanimate) ib.animate().rotation(-90).setduration(200); break;
thanks.
Comments
Post a Comment