Android问题集锦之二十八:You need to use a Theme.AppCompat theme (or descendant) with this activity.
2015-01-13 17:49
661 查看
错误描述为:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
起因:
我想在Manifest中设置我的activity全屏,代码如下:
原因:
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里就无意中继承了ActionBarActivity,它来自android.support.v7.app.ActionBarActivity。
所以就要使用与其配合的AppCompat的theme才行。
解决:
1.根据提示来使用AppCompat的theme,如下:
2.如果不是那么强烈需要继承自ActionBarActivity,就直接继承Activity吧。问题自然搞定!
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
起因:
我想在Manifest中设置我的activity全屏,代码如下:
<activity android:name=".MainActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:label="@string/app_name" >
原因:
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里就无意中继承了ActionBarActivity,它来自android.support.v7.app.ActionBarActivity。
所以就要使用与其配合的AppCompat的theme才行。
解决:
1.根据提示来使用AppCompat的theme,如下:
<activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:label="@string/app_name" >不过我要设置全屏,但我并没有找到,所以虽然错误不见了,但并没有达到我的预期。
2.如果不是那么强烈需要继承自ActionBarActivity,就直接继承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问题集锦之二十八: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 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 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
- 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.
- 关于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进阶之旅】解决bug:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android解决在清单文件里消除Bar报错: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