在android中去掉标题栏有三种方法,它们也有各自的特点。
1.在代码里实现
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
这句代码要写在setContentView()前面。
2.在清单文件(manifest.xml)里面实现
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
3.在style.xml文件里定义
<?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">