去标題欄的三種方式:
第一種:
requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标題欄
第二種:在AndroidManifest.xml檔案中定義
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
第三種 :在res/style檔案定義樣式
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="notitle">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/notitle">
第一種,有的時候我們會看到,會先出現标題欄,然後再消失,因為我們隻是在activity的oncreate方法中定義的,第二種相對第一種比較好一些,不會出現這種情況,第三種我個人感覺最好,這樣把功能分開,便于維護和擴充。
全屏的三種方法: 第一種:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
第二種:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
第三種:
application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/fullscreem"