在android中去掉標題欄有三種方法,它們也有各自的特色。android
1.在代碼裏實現app
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標題欄 this
記住:這句代碼要寫在setContentView()前面。spa
2.在清單文件(manifest.xml)裏面實現.net
<application android:icon="@drawable/icon" orm
android:label="@string/app_name" xml
android:theme="@android :style/Theme.NoTitleBar"> get
這樣用能夠將整個應用設置成無標題欄,若是隻須要在一個Activity設置成一個無標題欄的形式,只要把上面的第三行代碼寫到某一個Activity裏面就能夠了。string
3.在style.xml文件裏定義it
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="notitle">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
而後面manifest.xml中引用就能夠了,這種方法稍麻煩了些。
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/notitle">
其實能夠看得出來,第二種方法和第三種方法實質是同樣的,只不過第二種方法調用的是系統定義好的style.xml文件,而第三種方法則是在本身的應用裏定義style.xml,而後再本身再調用,其實道理是同樣的,第三種方法作起來更有成就感。