requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
注意这句必定要写在setContentView()方法的前面,否则会报错的 android
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">web
能够看出,这样写的话,整个应用都会去掉标题栏,若是只想去掉某一个Activity的标题栏的话,能够把这个属性加到activity标签里面app
例如:spa
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="notitle">
<item name="android:windowNoTitle">true</item>
</style>
</resources>code
这样,咱们就自定义了一个style,就至关于一个主题,而后在AndroidManifest.xml文件中定义orm
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/notitle">xml
这样也能够达到去掉标题栏的效果string