Reputation: 28178
I need to hide the navigation bar (the one with the back button) in Os 4.0+. I'm trying to do this without resorting to code. This is my styles.xml
resource file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
</style>
<style name="FullScreen" parent="@android:style/Theme.NoTitleBar.Fullscreen">
</style>
</resources>
And here's my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx.xxx.xxx.xxx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="xxx.xxx.xxx.xxx.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullScreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I'm trying to set Holo light as the global theme, and the fullscreen theme only for the main activity. The above files do not work, the only way I've found is to do this in my activity's onCreate:
mainView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Is there anything wrong with the xml-only approach?
PS: I know this is not possible in 3.x, but I'm testing this in a 4.1 simulator and I'm able to hide the navigation bar with setSystemUiVisibility
.
Upvotes: 1
Views: 4409
Reputation: 28178
Finally it seems this is not possible using only XML. And even using code, in some tablets (like Samsung Galaxy Tab) it is not possible to hide the navigation bar.
Upvotes: 2