我试图完全改变我的应用程序的主题,这是我修改过的&尝试过:
values文件夹中的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>
我正在使用ActionBaractivity& appcompat_v7但应用程序因java.lang.RuntimeException崩溃:无法启动活动ComponentInfo {com …}:java.lang.IllegalStateException:您需要将theme.AppCompat主题(或后代)与此活动一起使用
我错过了什么……?
我怎么解决这个问题?
请帮忙…
提前致谢 !
编辑:当使用Appcompat主题时,主题很轻,代码是:
所以,使用appcompat主题我在values文件夹中的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主题从光变为全黑.请帮忙
解决方法:
正如tyczj所指出的,如果您的应用使用appcompat_v7,则需要使用theme.AppCompat作为主题的父级. theme.AppCompat在视觉上与theme.Holo(暗)相同.
有关详细信息,请参阅AndroID文档中的article about styling the ActionBar.
总结以上是内存溢出为你收集整理的java – 无法将Appcompat主题从light更改为holo dark全部内容,希望文章能够帮你解决java – 无法将Appcompat主题从light更改为holo dark所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)