在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,而后再本身再调用,其实道理是同样的,第三种方法作起来更有成就感。