4

Just it, I have found how to hide title bar but I didnt find how hide / show the status bar pressing a button fr example. It is possible? thanks!

3 Answers 3

2

For poeple whose show part is not working , You can try following code

Show Status Bar

 if (Build.VERSION.SDK_INT < 16) { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { View decorView = getWindow().getDecorView(); // show the status bar. int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; decorView.setSystemUiVisibility(uiOptions); } 
Sign up to request clarification or add additional context in comments.

Comments

1

To hide a status Bar

Use this code in your Activity

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

Change Application theme in Manifest file as below

 android:theme="@android:style/Theme.Black.NoTitleBar" 

1 Comment

This does not cover the "show" part of "hide and show".
0

Reference - https://developer.android.com/training/system-ui/immersive.html

// This snippet shows the system bars. It does this by removing all the flags // except for the ones that make the content appear under the system bars. private void showSystemUI() { mDecorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } 

Although action bar is overlayed with the status bar.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.