Android学习之隐藏activity标题栏

来源:互联网 发布:儿童学唱歌软件 编辑:程序博客网 时间:2024/06/05 19:42

隐藏标题栏有三种方法

1.java代码里解决

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏 第一种方法

注意,这句换一定要写在这句代码要写在setContentView()前面

2.在AndroidManifest.xml文件里设置

<application android:icon="@drawable/icon"           android:label="@string/app_name"           android:theme="@android:style/Theme.NoTitleBar">  

找到对应activity进行设置。

3.在styles文件里定义,然后在AndroidManifest.xml里引用

定义:

<?xml version="1.0" encoding="UTF-8" ?>  <resources>      <style name="notitle">          <item name="android:windowNoTitle">true</item>      </style>   </resources>  

引用:

<application android:icon="@drawable/icon"           android:label="@string/app_name"           android:theme="@style/notitle">  
原创粉丝点击