Android 無標題、全屏設置

1、在主題中設置無標題、全屏java

(一):直接設置主題:android

  android:theme= "@android:style/Theme.NoTitleBar.Fullscreen"    // 不顯示應用程序標題欄,並全屏
  android:theme= "Theme.Light.NoTitleBar.Fullscreen"        // 白色背景,無標題欄,全屏
  android:theme= "Theme.Black.NoTitleBar.Fullscreen"        // 黑色背景,無標題欄,全屏

(二):在須要的Activity中添加對應主題:code

  android:theme="@style/Theme.NoTitle_FullScree"  blog

(三):在Theme中直接添加屬性:ci

  一、進入項目的mainfest文件中,查看 :get

    android:theme="@style/AppTheme" >

  二、進入主題:string

 <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

  三、再進入parent,在裏面添加<Item name="android:windowNoTitle">true</item>it

<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <item name="android:windowNoTitle">true</item>
    </style>

    到此,運行項目則沒有標題顯示!io

 2、代碼中實現全屏不標題:class

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);  //隱藏狀態欄

    requestWindowFeature(Window.FEATURE_NO_TITLE);//隱藏標題欄,放在setCountView()前

相關文章
相關標籤/搜索