关于新版SDK报错You need to use a Theme.AppCompat theme的两种解决办法
来源:互联网 发布:亚像素角点检测算法 编辑:程序博客网 时间:2024/05/17 08:33
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
- 关于新版SDK报错You need to use a Theme.AppCompat theme的两种解决办法
- 关于新版SDK报错You need to use a Theme.AppCompat theme的两种解决办法
- 关于新版SDK报错You need to use a Theme.AppCompat theme的两种解决办法
- Studio报错 You need to use a Theme.AppCompat theme的两种解决办法
- 报错You need to use a Theme.AppCompat theme的两种解决办法
- you need to use a theme.appcompat theme的解决方法
- You need to use a Theme.AppCompat theme的解决方案
- 报错 You need to use a Theme.AppCompat theme (or descendant) with this activity.
- DiaLogUtils报错java.lang. IllegalStateException You need to use a Theme.AppCompat theme
- 报错方案: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”错误
- 使用AlertDialog报错 You need to use a Theme.AppCompat theme (or descendant) with this activity.之解决
- Activity使用主题不兼容报错-You need to use a Theme.AppCompat theme (or descendant) with this activity
- linux查看当前加载的所有动态库
- 接口自动化测试,返回值深层完全断言大法
- jquery和js小知识
- 第2章 线性表
- 回调原子化方案调研
- 关于新版SDK报错You need to use a Theme.AppCompat theme的两种解决办法
- 元组、列表、字符串以及切片的一些小操作记录
- Unity_检测网络是否通畅
- PHP错误异常处理详解
- Javascript知识点
- android EditText获取光标位置并插入字符删除字符
- 并发服务器---多进程
- 从存在的项目创建自己的archetype
- linux下安装git