x06265616e
x06265616e

Reputation: 864

Android - Remove the status bar

Building a full screen application for ICS (4.0.3) and I need to remove the Status Bar completely.

I started to build my app using the Eclipse Template (Full screen activity), but i find when i click on the app the status bar reappears! - I don't want this!

I have got it at the moment by building a blank activity and setting the status bar to be the new transparent one (With the 3 light buttons)

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LOW_PROFILE);

This is the code I'm using to achieve this, any way of completely removing it? Or editing the full screen template so when you click or touch it doesn't re appear?

Cheers Richard

Upvotes: 0

Views: 4363

Answers (2)

Robin Davies
Robin Davies

Reputation: 7832

On ICS, there's two bars to consider: the navigation bar (at the bottom), and the status bar at the top. Status bar removal is done using the application theme. (It can be done in code as well).

The behaviour of the nav bar differs between ICS tablets, and ICS phones. On ICS tablets, the navigation bar can't be removed -- only put into low profile mode. On phones the NAV bar can be removed. And the code you posted should do it.

The action bar is yet a third option. I do believe the status bar is tied to the action bar show/hide in some samples. Search for occurrences of WindowManager.LayoutParams.FLAG_FULLSCREEN (used to show and hide the status bar in code) and edit the code you find accordingly.

Edit: oops. Too much time on 3.0 devices... New in API 16: SYSTEM_UI_FLAG_FULLSCREEN. Looks like what you want.

Upvotes: 2

Robert Estivill
Robert Estivill

Reputation: 12497

Try adding the following Theme to your activity declaration on the AndroidManifest.xml

For light theme

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

For dark theme

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

If you already have a theme, you might have to extend the correspondent theme.

Upvotes: 0

Related Questions