去掉標題欄有以下三種方法:
1.
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
2.代碼裏
requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標題欄
注意這句一定要寫在setContentView()方法的前面,不然會報錯的。而且這種有時候會看到程序啓動後標題欄閃一下消失的情況
3.
自定義主題去掉標題欄
<?xml version="1.0" encoding="UTF-8" ?> <resources> <style name="notitle"> <item name="android:windowNoTitle">true</item> </style> </resources>
然後在AndroidManifest.xml文件中定義
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/notitle" >
保持全屏:
1.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
2.
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
3.
<application application="" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/fullscreem" >