简体   繁体   English

“您需要使用Theme.AppCompat主题”

[英]“You need to use a Theme.AppCompat theme”

I'm programming an application on android, and I've a little problem : I would like to make a customiz Dialog box so I do like in the android documentation : 我正在android上编写应用程序,但有一个小问题:我想创建一个customiz对话框,所以我喜欢在android文档中:

In my manifest : 在我的清单中:

 <application android:allowBackup="true" android:icon="@drawable/indice" android:label="33" android:theme="@style/AppTheme"> <activity android:name=".Autres.Indice" android:theme="@android:style/Theme.Holo.Dialog"> </activity> 

In style : 很有型 :

 <style name = "AppTheme" parent="@style/Theme.AppCompat.NoActionBar"> </style> 

But when I run : Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 但是,当我运行时:由于:java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代)。

I don't understand, thank's^^ 我不明白,谢谢^^

You are having this issue because the activity you are trying to apply the dialog theme to is not extending Activity , that requires AppCompat theme. 您遇到此问题是因为您尝试将对话框主题应用于的Activity没有扩展Activity ,而该Activity需要AppCompat主题。

Change 更改

    android:theme="@style/AppTheme">

For 对于

    android:theme="@style/Theme.AppCompat" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您需要使用Theme.AppCompat主题 - You need to use a Theme.AppCompat theme 问题与您需要与此活动一起使用Theme.AppCompat主题(或后代)与该活动一起Theme.AppCompat主题(或后代)” - Issue with You need to use a Theme.AppCompat theme (or descendant) with this activity Theme.AppCompat theme (or descendant) with this activity" 错误消息:您需要与此活动一起使用Theme.AppCompat主题 - Error Message: You need to use a Theme.AppCompat theme with this activity 显示对话框 - IllegalStateException:您需要使用 Theme.AppCompat 主题 - Display dialog - IllegalStateException: You need to use a Theme.AppCompat theme 错误:您需要在此活动中使用Theme.AppCompat主题(或后代) - Error: You need to use a Theme.AppCompat theme (or descendant) with this activity 您需要使用 Theme.AppCompat 主题 --&gt; 在单元测试中 - You need to use a Theme.AppCompat theme --> in Unit Test 您需要使用Theme.AppCompat主题错误,即使主题设置为AppCompat也是如此 - You need to use a Theme.AppCompat theme error, even with theme set to AppCompat 在 android 中具有自定义主题的应用程序,错误:您需要在此活动中使用 Theme.AppCompat 主题(或后代) - app with custom theme in android, error: You need to use a Theme.AppCompat theme (or descendant) with this activity java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代) - java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity 如何修复您需要在 Android 的对话框中使用 Theme.AppCompat 主题 - How to fix You need to use a Theme.AppCompat theme in dialog on Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM