去掉Android(安卓)app上的Title Bar
16lz
2022-04-05
去掉Android上的Title Bar
方法一:修改code
在 public void onCreate(Bundle savedInstanceState)函数体中加
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
些方法明显能看到title bar显示了之后又消失了,给user的感觉不好。
方法二:修改AndroidManifest.xml
第一处: 好像修改这一处就可以了,不必要修改第二处的
<application
android:label="@string/app_name"
android:icon="@drawable/logo" android:theme="@android:style/Theme.NoTitleBar"
>
第二处:
<activity
android:label="@string/app_name"
android:name="MAndFileBrowser"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
>
方法三:修改style配置文件
第一处:在res/values文件夹下创建一个xml文件
内容如下:
<?xmlversion="1.0" encoding="utf-8"?>
<resources>
<style name="NoTitle" parent="android:Theme">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
第二处:AndroidManifest.xml
<activity
android:label="@string/app_name" android:name="MAndFileBrowser"
android:theme="@style/NoTitle"
>
以上都经过我的测试了,都可以成功,建议用第二种方法或第三种方法吧。更多数据请参考 http://alex-yang-xiansoftware-com.iteye.com/blog/760080
方法一:修改code
在 public void onCreate(Bundle savedInstanceState)函数体中加
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
些方法明显能看到title bar显示了之后又消失了,给user的感觉不好。
方法二:修改AndroidManifest.xml
第一处: 好像修改这一处就可以了,不必要修改第二处的
<application
android:label="@string/app_name"
android:icon="@drawable/logo" android:theme="@android:style/Theme.NoTitleBar"
>
第二处:
<activity
android:label="@string/app_name"
android:name="MAndFileBrowser"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
>
方法三:修改style配置文件
第一处:在res/values文件夹下创建一个xml文件
内容如下:
<?xmlversion="1.0" encoding="utf-8"?>
<resources>
<style name="NoTitle" parent="android:Theme">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
第二处:AndroidManifest.xml
<activity
android:label="@string/app_name" android:name="MAndFileBrowser"
android:theme="@style/NoTitle"
>
以上都经过我的测试了,都可以成功,建议用第二种方法或第三种方法吧。更多数据请参考 http://alex-yang-xiansoftware-com.iteye.com/blog/760080
更多相关文章
- Android(安卓)图片旋转(使用Matrix.setRotate方法)
- Android根据电量变化为不同图片的方法【电池电量提示】
- Android之日期时间选择器使用方法
- Android(安卓)启动浏览器的方法
- Android蓝牙通信代码
- 对比onSaveInstanceState和onRestoreInstanceState
- Gradle 修改生成apk时的文件名
- 浅谈Java中Collections.sort对List排序的两种方法
- Python list sort方法的具体使用