gpt4 book ai didi

Android 风格应用 minSdkVersion ="8"targetSdkVersion ="21"

转载 作者:行者123 更新时间:2023-11-29 20:47:56 24 4
gpt4 key购买 nike

我正在使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com