找不到与给定名称'@ style/Theme.Holo.Light.DarkActionBar'匹配的资源

use*_*222 54 android

平台:4.3

API等级:18

AndroidManifest.xml中:

<uses-sdk
    android:minSdkVersion="18"
    android:targetSdkVersion="18" />
Run Code Online (Sandbox Code Playgroud)

值-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.Light">
</style>

 <style name="CustomActionBarTheme"
       parent="@style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar"
       parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@drawable/actionbar_background</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我是一个Android新手.非常感谢!

Sus*_*hil 88

做这个:

"android:style/Theme.Holo.Light.DarkActionBar"
Run Code Online (Sandbox Code Playgroud)

android在样式之前错过了关键字.这表示它是Android的内置风格.

  • 官方文档包含错误(没有`android`前缀):https://developer.android.com/training/basics/actionbar/styling.html (31认同)

Har*_*ake 14

确保您已将Project Properties(而不是清单)中的目标API(与目标SDK不同)设置为至少4.0/API 14.


Bou*_*uis 9

@android对我不起作用.当我使用android(没有@)时,它就像一个魅力.

例:

<style name="CustomActionBarTheme"
       parent="android:style/Theme.Holo.Light.DarkActionBar">
Run Code Online (Sandbox Code Playgroud)