How to hide the animation of actionbar show and hi

2019-08-11 01:54发布

问题:

I have an activity contain an tabhost. And I use several fragments for the tabhost, each tab only has one fragment, that means the fragment size is matching the parent. However , not all fragment has actionbar.

For example, the first one hide actionbar while the other show the actionbar.

The problem is , when I show / hide the actionbar, it does not transacts instantly, but it has an amination that e.g. for the case hide->show , the actionbar is hide and leave a blank space on the screen , then the content screen will expand to fit the screen . It cause some "glitch" in the ui , so are there any way to fix it?

I tried requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌​AY); Which the animation is hide but the actionbar is overlay the content instead of a part of the content,

Update:

The overlay of actionbar is like this screenshot , it is on top of the content. please have a look

回答1:

Please see a work around here for requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌​AY);

Using ActionBarSherlock; experiencing View.getLocationOnScreen() inconsistency between 2.2 and ICS/JB

Also for the hide and show method can you please confirm if you are calling it within onCreate method of your fragment?

Could you post the code where you are making the call?