Is there a way to disable show / hide ActionBar animation?

I saw this question:

Change ActionBar merge animation?

But he does not say whether animation can be turned off altogether.

+9
source share
3 answers

Now you can do it,

getSupportActionBar().setShowHideAnimationEnabled(false); 
+13
source

I fixed using the method below:

 public static void disableShowHideAnimation(ActionBar actionBar) { try { actionBar.getClass().getDeclaredMethod("setShowHideAnimationEnabled", boolean.class).invoke(actionBar, false); } catch (Exception exception) { try { Field mActionBarField = actionBar.getClass().getSuperclass().getDeclaredField("mActionBar"); mActionBarField.setAccessible(true); Object icsActionBar = mActionBarField.get(actionBar); Field mShowHideAnimationEnabledField = icsActionBar.getClass().getDeclaredField("mShowHideAnimationEnabled"); mShowHideAnimationEnabledField.setAccessible(true); mShowHideAnimationEnabledField.set(icsActionBar,false); Field mCurrentShowAnimField = icsActionBar.getClass().getDeclaredField("mCurrentShowAnim"); mCurrentShowAnimField.setAccessible(true); mCurrentShowAnimField.set(icsActionBar,null); }catch (Exception e){ //.... } } } 
+11
source

If you use ActionBarSherlock, you can do it. See the ActionBarImpl class, it has the setShowHideAnimationEnabled method (with logical inclusion).

+4
source

All Articles