2013-08-21 35 views
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来隐藏导航栏。

+0

相似问题:http://stackoverflow.com/questions/9926767/is-there-a-way-to-hide-the-system-navigation-bar-in-android-ics –

回答

1

最后似乎这是不可能的只使用XML。甚至使用代码,在某些平板电脑(如Samsung Galaxy Tab)中,不可能隐藏导航栏。