I need to show / hide the status bar in the same Activity (Fragment) for API 17+. Let's say one button hides it, the other shows it:
Show:
getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
Hide
getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
This works fine, but there is a slide-up animation when it changes to full-screen mode rather than full-screen mode. How to remove this animation? I want the status bar to disappear immediately, I tried:
requestWindowFeature(Window.FEATURE_NO_TITLE);
But nothing happened, it still appears with the animation, I also read:
how to remove the status bar animation when switching to full-screen mode in Android https://groups.google.com/forum/#!topic/android-developers/hS1twXVoorc
source share