1

Does any body have idea about how to hide system bar in android and make it visible only when swiping up on the screen. Other wise it remains hidden all the time. I got code for hide the system bar when the activity loading first time. When I am touching on the screen it become visible and stays always visible, system bar is not hiding till another activity loads. Please Help.

Thanks in advance

S S
  • 189
  • 5
  • 23
  • 1
    getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); This is the code i got for hiding system bar in android – S S Feb 24 '15 at 05:32

2 Answers2

4

Just make full screen activity in eclipse...and rest will done by android..enter image description here

BHARAT GUPTA
  • 462
  • 1
  • 4
  • 10
  • Ok. so it will hide system bar automatically and when we touch on screen system bar make visible and viceversa? – S S Feb 24 '15 at 10:36
0

First of all, to do this your application would have to be full screen or rooted.And it all depends on the Android Version you are using. For Android 4.0 and lower, you can use this in your manifest:

<application
...
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
...
</application>

Alternatively, you can programmatically set WindowManager flags. This approach makes it easier to hide and show the status bar as the user interacts with your app:

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // If the Android version is lower than Jellybean, use this call to hide
    // the status bar.
    if (Build.VERSION.SDK_INT < 16) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    setContentView(R.layout.activity_main);
}
...

Go to the developer site for more on this. I'd also visit this SO question for more in-depth information

Community
  • 1
  • 1
Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132