今天,寫了一個(gè) 小的程序,美觀起見,想要去除標(biāo)題欄;當(dāng)然,我們?nèi)コ龢?biāo)題欄可以做的操作有很多,例如:
必須要寫在setContentView()前面的:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標(biāo)題欄
在AndroidManifest.xml文件修改:
android:theme="@android:style/Theme.NoTitleBar"
當(dāng)然這樣的操作都是 默認(rèn)的操作選擇。
現(xiàn)在我們分享的是在自定義Style.xml中修改無標(biāo)題欄:
首先貼上代碼:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
然后在AndroidManifest.xml文件中:
android:theme="@style/AppTheme"
這里一定要注意parent的屬性,設(shè)置為NoActionBar,