Reputation: 3139
I am trying this code which is shown in google developer's page,but at no vail.
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();
Should I add something on the manifest file too?
Thank you.
Upvotes: 1
Views: 540
Reputation: 3139
I came back to solve this problem and fixed it by adding..
requestWindowFeature(Window.FEATURE_NO_TITLE);
Thank you.
Upvotes: 0
Reputation: 468
In my opinion it would be easier to set the theme in res -> value -> styles.xml
Change your main "AppTheme"
parent to
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">
</style>
This will work for API versions 11+ ... To remove / hide action bar for API versions lower than 11 use parent:
android:Theme.Light.NoTitleBar
Upvotes: 1
Reputation: 2657
Hi Theo your code hides action bar but don't block this, no? This code works for me, just hides my action bar but if the user clicks in top screen he can use it, because I remember it's impossible to block action bar because if it is a malicious app the user can scape from this. Too I use this code:
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
Without ActionBar, I have this code in one app with android > 4.1. I hope to be of help, good luck and say me if you need more help!
Upvotes: 1
Reputation: 383
You can hide your action bar with code like this.
ActionBar actionbar = getActionBar();
actionbar.hide();
Or as M D mentioned, you can hide your action bar with NO Action Bar Theme.
Upvotes: 1