1
我需要隱藏Os 4.0+中的導航欄(帶有後退按鈕的導航欄)。我試圖做到這一點,而不訴諸於代碼。這是我styles.xml
資源文件:無法隱藏僅使用xml樣式的導航欄
<?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>
這是我的清單:
<?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>
我正在嘗試設置全息光作爲全球主題,只爲主要活動的全屏的主題。上述文件不工作,我發現的唯一辦法就是做這在我活動的onCreate:
mainView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
這有什麼錯與XML的唯一途徑? PS:我知道這在3.x中是不可能的,但是我在4.1模擬器中測試了這個,我可以用setSystemUiVisibility
來隱藏導航欄。
相似問題:http://stackoverflow.com/questions/9926767/is-there-a-way-to-hide-the-system-navigation-bar-in-android-ics –