无法将Appcompat主题从光线更改为全黑

我试图完全改变我的应用程序的主题,这是我修改和尝试:

值文件夹中的styles.xml

 <resources> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --> <style name="AppBaseTheme" parent="android:Theme.Holo"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> </resources> 

values-v11 styles.xml

 <resources> <!-- Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. --> <style name="AppBaseTheme" parent="android:Theme.Holo"> <!-- API 11 theme customizations can go here. --> </style> </resources> 

values-v14 styles.xml

 <resources> <!-- Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. --> <style name="AppBaseTheme" parent="android:Theme.Holo"> <!-- API 14 theme customizations can go here. --> </style> </resources> 

Mainifest.xml

 <application ..... android:theme="@style/AppTheme" > ....... </application> 

我正在使用ActionBarActivityappcompat_v7但应用程序崩溃java.lang.RuntimeException: Unable to start activity ComponentInfo{com...}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

我错过了什么…?

我怎么解决这个问题?

请帮忙…

提前致谢 !


编辑:当使用Appcompat主题,主题是轻的,代码是:

所以,使用appcompat主题我的styles.xml值文件夹是

 <resources> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --> <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> </resources> 

values-v11 styles.xml

 <resources> <!-- Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. --> <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> <!-- API 11 theme customizations can go here. --> </style> </resources> 

values-v14 styles.xml

 <resources> <!-- Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. --> <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- API 14 theme customizations can go here. --> </style> </resources> 

Mainifest.xml

 <application ..... android:theme="@style/AppTheme" > ....... </application> 

而我不知道如何改变appcompat主题从光到全黑。 请帮忙

Solutions Collecting From Web of "无法将Appcompat主题从光线更改为全黑"

正如tyczj指出的,如果你的应用使用appcompat_v7 ,你需要使用Theme.AppCompat作为你的主题的父appcompat_v7Theme.AppCompat在视觉上与Theme.Holo (dark)相同。

有关更多信息,请参阅关于在Android文档上设置ActionBar样式的文章 。