I need to show / hide status bar in the same Activity(Fragment) for API 17+. Let's say one button will hide it, the other one will show 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-down" animation when it changes for full screen - not fullscreen. How to remove this animation? I want status bar to disappear immediately, I've tried with:
requestWindowFeature(Window.FEATURE_NO_TITLE);
But nothing happened, it is still showing up with animation, I've also read:
how to remove statusbar animation when changing to fullscreen in Android https://groups.google.com/forum/#!topic/android-developers/hS1twXVoorc
Note the bright red line on the bottom of the screen. To restore the navigation buttons and status bar, slide up the red line at the bottom of the screen. To again disable the status bar, fire the third rectangle icon or tap the red line.
On Android, the status bar contains notification icons and system icons.
Have you tried using this attribute in the activity or fragment layout, ideally under the root view
android:animateLayoutChanges="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With