10

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

Community
  • 1
  • 1
Djordje Tankosic
  • 1,975
  • 2
  • 20
  • 21

1 Answers1

1

Have you tried using this attribute in the activity or fragment layout, ideally under the root view

android:animateLayoutChanges="false"
Niladree
  • 526
  • 3
  • 14