You need to use a Theme.AppCompat theme (or descendant) with this activity.
来源:互联网 发布:哪个象棋软件好 编辑:程序博客网 时间:2024/06/08 19:56
最近项目里需要用到toolbar(android.suppoert.v7.widget.Toolbar),然而原来的Activity是继承Activity而不是AppcompatActivity,故而不能使用toolbar.
当把继承对象改为AppcompatActivity,进行该画面的时候就直接报错了..
提示信息是 : java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
这已经说的很清楚了..你需要将你当前的Activity的主题改为Theme.Appcompat的相关主题,继承自该主题的主题也可以.
所以问题就迎刃而解了.
博主使用的主题是这样的 :
<style name="AppBaseTheme" parent="Theme.AppCompat.NoActionBar"> <!-- customize the color palette --> <item name="colorPrimary">#000000</item> <item name="colorPrimaryDark">@color/primary</item> <item name="colorAccent">@color/ripple</item> </style>只要在AndroidManifest这个配置文件里面在当前Activity标签的主题(即android:theme=@style/AppBaseTheme)问题就可以解决.该内容需要复制到res/values/styles.xml文件中,问题就可以解决.
0 0
- 关于“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
- 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解决方法
- 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.
- 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 Studio 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解决方法
- C语言的基本运算
- 股票成交价
- 20160124.CCPP详解体系(0003天)
- 嵌入式的瑞士军刀 - BusyBox
- 栈、双链表
- You need to use a Theme.AppCompat theme (or descendant) with this activity.
- 20160125.CCPP详解体系(0004天)
- (java) Search a 2D Matrix
- css属性 知识总结
- 20160126.CCPP体系详解(0005天)
- 用c语言代码编写的游戏“简易五子棋”
- Java基础04 封装与接口
- 编程题#3:计算数列平方和(C++程序设计第10周)
- C语言的流程控制