首页 > 移动平台 > 详细

android应用中去掉标题栏的方法

时间:2015-07-28 12:50:18      阅读:238      评论:0      收藏:0      [点我收藏+]

在style.xml文件里定义

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

然后在manifest.xml中引用就可以了

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

 

如果错误描述为

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

 

原因:
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里就无意中继承了ActionBarActivity,它来自android.support.v7.app.ActionBarActivity。
所以就要使用与其配合的AppCompat的theme才行。

android应用中去掉标题栏的方法

原文:http://www.cnblogs.com/haobadea/p/4682248.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!