Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 设置操作栏样式时出错_Android - Fatal编程技术网

Android 设置操作栏样式时出错

Android 设置操作栏样式时出错,android,Android,从清单:最小版本14 <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> 风格: <style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <!-- Theme customizations available

从清单:最小版本14

<uses-sdk
     android:minSdkVersion="14" 
     android:targetSdkVersion="19" />
风格:

<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>

我得到了一个错误,没有找到任何资源,在styles AppBaseTheme和ThegoActionBar上有两个单独的值文件夹,特别是在“应用主题化”文件夹中,这是非常具体的原因

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

我想提请您注意注释代码

新API级别中可用的主题自定义可以在res/values vXX/styles.xml中使用

xml用于向后兼容,您可以更改父样式 parent=android:Theme.Light到parent=android:Theme.Holo.Light.darkaActionBar

这是错误的,因为android:Theme.Holo.Light.DarkActionBar是在API级别14中引入的,请参见此处。构建器查找Theme.Holo.Light.DarkActionBar,但找不到它,因为它适用于新版本,因此您可以看到

我在样式AppBaseTheme和ThegoActionBar上都发现了“未找到资源”错误

只需将自定义样式的代码移动到values-v14\styles.xml,一切都会很好,如果values\styles.xml中没有提供样式,请不要担心,直到您的minsdk版本为14


我希望你能理解。

请发布日志。我想我几乎得到了所有信息,我应该将代码移到te-a-Apapiate文件夹中。但是我应该在样式中添加什么呢。如果values\styles.xml中没有提供样式,请不要担心,那么我是否应该将其留空?是的,您可以,因为您的应用程序专门针对更高的API,样式设置不会有太大问题,接受答案会有帮助
<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>