首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误样式操作栏android

错误样式操作栏android
EN

Stack Overflow用户
提问于 2014-04-24 19:21:22
回答 1查看 85关注 0票数 0

清单:最小版本14

代码语言:javascript
复制
<uses-sdk
     android:minSdkVersion="14" 
     android:targetSdkVersion="19" />

风格:

代码语言:javascript
复制
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
        <!--
            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">
    <item name="android:windowBackground">@color/fondoObscuro</item>
    <item name="android:actionBarStyle">@style/OnTheGoActionBar</item>

</style>


 <!-- general styles for the action bar -->
<style name="OnTheGoActionBar"
       parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:titleTextStyle">@style/TitleTextStyle</item> 
    <item name="android:background">@color/actionBarObscura</item> 
    <item name="android:actionOverflowButtonStyle">@style/CustomOverflow</item>


</style>

我在AppBaseTheme和OnTheGoActionBar两种样式上都没有找到任何资源错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-24 19:53:15

有非常明确的理由有两个独立的values文件夹,特别是对于“主题化应用程序”

正如您在发布的代码中所看到的,我确信下面的代码来自values\styles.xml

代码语言:javascript
复制
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
        <!--
            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>

我想提请您注意注释代码。

Theme customizations available in newer API levels can go in res/values-vXX/styles.xml

styles.xml是为了向后兼容性,将parent样式parent="android:Theme.Light"更改为parent="android:Theme.Holo.Light.DarkActionBar"

这是错误的,因为android:Theme.Holo.Light.DarkActionBar是在APILevel-14中引入的,参见这里的DarkActionBar Android文档。生成器查找Theme.Holo.Light.DarkActionBar,但无法找到它,因为它适用于新版本,因此您可以看到

I got the error no resource found, on both styles AppBaseTheme and OnTheGoActionBar

简单地将您的定制样式代码移动到values-v14\styles.xml,一切都会很好,如果您没有values\styles.xml提供的样式,请不要担心,除非您的minSdkVersion是14。

我希望你能理解。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23277965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档