android studio怎樣隱藏標題欄

  • 同時隱藏標題欄和通知欄
//方法-:在清單文件中

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        >


//方法二:在activity的onCreate方法寫入以下代碼:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標題欄

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息欄 
  • 隱藏標題欄
//方法一:在清單文件中

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.NoTitleBar"> //去掉標題欄
        ....

//方法二:在activity的onCreate方法寫入以下代碼:

 this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標題欄
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章