Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Animation for ActionMode in AppCompat v23

In version 23 of AppCompat it has been introduced a fade in/out animation for the ActionMode, but I need to disable it.

Motivation: I change the background color of a TabLayout and I am not able to reproduce the very same fading animation, so it looks strange. I tried with ObjectAnimator, but it is not a proper "alpha" effect as in the new AppCompat v23.

According to here appcompat-v7 v23.0.0 statusbar color black when in ActionMode (answer from Mattia) it seems the animation is created from Java (thus not possible to overwrite the xml in the "anim" folder):

mFadeAnim = ViewCompat.animate(mActionModeView).alpha(0f);

Any idea on how to disable the new ActionMode animation?

Reproducing the very same effect between two colors would be also an alternative for me but, as explained before, it does not feel the same...

Thanks, Andrea

like image 355
agirardello Avatar asked Jan 19 '26 04:01

agirardello


1 Answers

I had the same problem. I solved it this way:

1) Showing actionmode: I don't disable fadein animation: I just set color of actionbar to the same color as actionmode.

2) Hiding actionmode: For disabling fadingout I just make this call in onDestroyActionMode:

findViewById(R.id.action_mode_bar).setVisibility(View.INVISIBLE);

Don't forget to set previous color to actionbar after that.

like image 177
wilddev Avatar answered Jan 20 '26 20:01

wilddev