Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
来源:互联网 发布:淘宝银座365是正品吗 编辑:程序博客网 时间:2024/05/12 05:53
androidstudio的一个小问题:
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"
例子:
<activity
android:name="com.vmoksha.BaseActivity"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
然后在styles.xml中加入主题资源:
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
</style>
即可
0 0
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- eclipse:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) wit
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant
- Properties文件的读取。
- C语言单链表和双链表的创建和输出
- 线程池之深度了解-ThreadPoolExecutor
- go中channel简单使用
- Lua代码编写注意点
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- hdu2149——Public Sale(巴什博弈)
- Myeclipse2014 创建WebService 服务端简单示例
- 拆箱和装箱的小知识
- lua中的全局函数
- MFC对话框背景图片的设置
- AES加密CBC模式兼容互通四种编程语言平台【PHP、Javascript、Java、C#】
- 【转载】ABAP 动态列表的创建
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常