indraja machani
indraja machani

Reputation: 679

How to hide the Status Bar?

I am trying to hide the status bar. I have tried the following things.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

In the Manifest.XML I have added the above code.

And in the onCreate() I have added the following:

requestWindowFeature(Window.FEATURE_NO_TITLE);
// hide statusbar of Android
// could also be done later
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

But still I am unable to hide the status bar. Can anyone help?

Upvotes: 1

Views: 979

Answers (2)

Harshad
Harshad

Reputation: 8014

Just make sure that you are writing above code lines before the line setContentView()?

Upvotes: 0

cjds
cjds

Reputation: 8426

The approaches you've taken would work on 2.3.X

But if you are talking about 4.0 tablets this is the code

LinearLayout layout = (LinearLayout)findViewById(R.id.layout);    
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

If you're talking about a tablet you cannot get rid of the system bar but I suggest you look at this question:

Hide Status bar on Android Ice Cream Sandwich

Upvotes: 2

Related Questions