在android开发过程中经常会遇到,我们已近在xml布局文件中将头部的那个textview去掉了,但是在软件运行的时候仍旧会出现图片上红色方框中的头部lable,这个是因为android系统默认的主题有关,现在我就教大家去掉这个label,其实做法很简单。
方法/步骤
-
方法一:
在AcdroidMainfest.xml中
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
>添加Theme属性,设置为NoTitleBar即可
-
方法二:
public void onCreate(BundlesavedInstanceState) {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
...}requestWindowFeature(Window.FEATURE_NO_TITLE);
要写在setContentView(R.layoutmain)前面,每个activity页面代码中都加上这一句就可以了