4

How to hide status bar (phone icon,battery icon, network icon etc.) in android?

Confuse
  • 5,646
  • 7
  • 36
  • 58
user3168129
  • 151
  • 1
  • 2
  • 6

3 Answers3

4

Write this code just above setContentView(R.id.activity_main) and it will work.

requestWindowFeature(Window.FEATURE_NO_TITLE);     
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Sagar Pilkhwal
  • 3,998
  • 2
  • 25
  • 77
Nithin
  • 503
  • 4
  • 19
2

You can also change theme in Android Manifest to hide the status bar such that you don't have to call the code in every activity.

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

If you are not using Holo, you may need to change that slightly.

Alternatively, you can call this code in each activity -

For 4.0 and Lower

Add this in onCreate method before setContentView(R.layout.activity_main); line.

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

For 4.1 and higher

View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
Confuse
  • 5,646
  • 7
  • 36
  • 58
1

In your manifest you can add android:theme="@android:style/Theme.NoTitleBar".

In your Activity you can add getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

Hope this will help you in finding your solution.