Android报错集锦之一:You need to use a Theme.AppCompat theme (or descendant) with this activity.
来源:互联网 发布:怪物猎人ol激活码淘宝 编辑:程序博客网 时间:2024/06/11 19:29
Android 报错提示:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
报错原因:
Android新建工程MainActivity默认继承AppCompatActivity,而在AndroidManifest.xml里theme主题同样默认继承Theme.AppCompat.Light.DarkActionBar。如果没有修改MainActivity的继承类为Activity,而只修改activity:theme的属性,理所当然会报错。
解决问题:
1.直接修改@style/AppTheme的属性值,设置合理的item:
<style name="AppTheme"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item></style>
2.修改MainActivity的继承类为Activity
阅读全文
0 0
- Android报错集锦之一:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- 报错 You need to use a Theme.AppCompat theme (or descendant) with this activity.
- 报错方案:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- 对话框报错 You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android开发~you need to use a theme.appcompat theme (or descendant) with this activity
- 【Android】You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法
- Android Studio You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法
- Android错误之:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android Studio中报错 You need to use a Theme.AppCompat theme (or descendant) with this activity
- Android问题一:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android--You need to use a Theme.AppCompat theme (or descendant) with this activity解决方案
- Android异常-You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android Studio: You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android 解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity
- Android issue: You need to use a Theme.AppCompat theme (or descendant) with this activity
- Android错误:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android问题集锦之二十八:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android问题集锦之二十八:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- 线程并发五:线程安全之重入锁
- C#语言之“string格式的日期时间字符串转为DateTime类型”的方法
- Replication error Agent message code 20002 due to OS error 2.
- Linux-HA 高可用开源方案 Keepalived VS Heartbeat 的选择
- 15基于opencv的旋转_仿射变换_SURF特征点检测
- Android报错集锦之一:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- c++11通过变参模板实现特殊的数据结构和算法
- spring和mybactis的整合
- Glide使用中遇到的问题
- 时间处理
- C#下WPF中调用WinForm控件
- V-layout自我学习总结(自我记录)
- cocos2dx 截取屏幕保存至手机相册中
- 升序和降序操作