android的一个小问题:

 

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

法一:

当在AndroidManifest.xml文件的application的节点设置了属性:

android:theme="@android:style/Theme.NoTitleBar

而Activity继承了ActionBarActivity就回出现上述错误,解决的办法就是让Activity去继承Activity而不是ActionBarActivity

改完之后删掉报错的部分,然后别忘了导入Activity包

法二:

在AndroidMenifest.xml中加入一句:

android:theme="@style/Theme.AppCompat.Light.NoActionBar"

例子:

           android:name="com.vmoksha.BaseActivity"        android:label="@string/app_name"         android:theme="@style/Theme.AppCompat.Light.NoActionBar"        >                     android:name="android.intent.action.MAIN" />             android:name="android.intent.category.LAUNCHER" />            

然后在styles.xml中加入主题资源:

      name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">         <item name="android:windowNoTitle">trueitem>     

即可

更多相关文章

  1. Catalog Service - 解析微软微服务架构实例代码
  2. 介绍一个微软开源项目网站--CodePlex
  3. c# webservice中访问http和https的wsdl以及生成配置节点的不同之
  4. go语言如何删除链表节点
  5. java对XML文件的解析、节点的增加、删除操作总结
  6. XML(4)XDocument和XmlDocument搜索指定的节点
  7. xml学习(7) .net 获取xml节点或者属性最大值
  8. FireFox对XML的处理兼容IE的节点处理方法
  9. 读写xml所有节点个人小结 和 读取xml节点的数据总结

随机推荐

  1. TextView跑马灯必成五属性
  2. 第5章 Android常见XML属性解析-更新中
  3. android:Button添加图片
  4. Android系统启动——8 附录2:相关守护进程
  5. Android(安卓)屏幕自适应方向尺寸与分辨
  6. Android(安卓)SDK Android(安卓)NDK Andr
  7. Android使用两个Activity页面切换…
  8. Android(安卓)mainfest文件 android属性
  9. Android(安卓)背景图片平铺
  10. Activity XML 属性详解