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
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); } Comments
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
yiati
This does not cover the "show" part of "hide and show".
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.