[英]“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.