消除标题栏
第一种:在AndroidManifest.xml文件中定义
< application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
可以看出,这样写的话,整个应用都会去掉标题栏,如果只想去掉某一个Activity的标题栏的话,可以把这个属性加到activity标签里面
第二种:这种在一般的应用中不常用,就是在res/values目录下面新建一个style.xml的文件
[放在其他文件下目录下不行,只有放在values下系统才会把style读进去 才能@来用]
例如:
< ?xml version="1.0" encoding="UTF-8" ?> < resources> < style name="notitle"> < item name="android:windowNoTitle">true< /item> < /style> < /resources>
这样,我们就自定义了一个style,就相当于一个主题,然后在AndroidManifest.xml文件中定义
< application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/notitle">
这样也可以达到去掉标题栏的效果
全屏的方法
第一种
最简单 最方便 但修改麻烦
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
第二种
稍微麻烦 但修改容易 只需要修改自己写的风格文件即可
自己写一个XML文件放在res/values文件夹下
xml文件内容
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="fullscreem">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
最后添加 android:theme="@style/fullscreem"