我正在使用 minSdkVersion="8"和 targetSdkVersion="21"创建一个应用
在 AndroidManifest 中我有:
android:theme="@style/AppTheme"
在文件 styles.xml 中:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
</style>
在文件 values-v11/styles.xml 中:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
在文件 values-v14/styles.xml 中:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Activity
扩展到 ActionBarActivity
当我运行该应用程序时出现此错误:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
我需要做什么才能让应用运行良好?
最佳答案
您遇到此问题的原因是 Activity
你正在扩展 ActionBarActivity
这需要 AppCompat
要应用的主题。
从 ActionBarActivity
更改 Java 继承至 Activity
.
关于Android 风格应用 minSdkVersion ="8"targetSdkVersion ="21",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29941336/