Android Animate Menu Items when showing/hiding them -
to animate this menu item when they may appear in the action bar?
I have 3 pieces in a horizontal pager to see, when I am at first, I am this amount:
And on the other piece, I The amount:
But when I'm swiping for each other, items in the action bar just pop (or pop up) or get frustrated, and I think That it will be a better user experience if they slide toward the right side.
Thanks a lot.
You can animate your menu item in onCreateOptionsMenu (menu menu) . A poor implementation may occur in this way:
Public category Your paragraph fragment expansion (Private boolean mShouldAnimateMenuItem = true; @ Override Public Boolean on Crate Option menu (last menu menu) {getMenuInflater (). Flowers (R. menu.aire_menu, menu); if (mShouldAnimateMenuItem) {ImageView image = new ImageView (this); image.setImageResource (R.drawable.your_menu_item_icon); menu.getItem (0) .setActionView (image); // 0 Position Animation Anim in AnimationUtils.loadAnimation (getActivity (), R.anim.translate_from_right_to_current_accelerate_fast); anim.setAnimationListener (New AnimationListe Ner () {@Override Public Zero onAnimationStart (Animation Animation) {// TODO Automatic Created Method Stub} @Override Public Zero onAnimationRepeat (Animation Animation) {// TODO Automatic Created Method Stub} @Override Public Zero on AnimationAnd (Animation Animation ) {Menu.getItem (0) .setActionView (empty);}}) ;. Menu.getItem (0) .getActionView () startAnimation (anim); MShouldAnimateMenuItem = false; } Back true; }} In this way you animate actionView and once this happens, you just leave actionView for your item.
translate_from_right_to_current_accelerate_fast.xml
& Lt; / Set & gt;
Comments
Post a Comment