2

I was trying to follow google's tutorial (http://developer.android.com/training/basics/actionbar/styling.html) to styling an action bar. However the xml file shows some errors underlined in red. Can someone please tell what this means and how to correct it.

I am getting errors on line 6 "android:actionBarStyle" and the error says "android:actionBarStyle requires API level 11 (current min is 8)"

Another error at line 15 "@drawable/actionbar_background" and the error is "error: Error: No resource found that matches the given name (at 'android:background' with value '@drawable/actionbar_background')". I can understand that no resource is present in the drawable folder, but not the same error is shown on line 17 where the same statement is mentioned?

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/actionbar_background</item>

        <!-- Support library compatibility -->
        <item name="background">@drawable/actionbar_background</item>
    </style>
</resources>

Any help would be appreciated.
-Beginner at android

[UPDATE] Also, please suggest what should go inside the drawable folder to make action bar show a red/black/any color background?

PeteBeat
  • 271
  • 4
  • 11

1 Answers1

0

you not use android:actionBarStyle for API Level 8, only 11 or bigger. To fix it, edit your AndroidManifest and set theminVersion at 11.

Loures
  • 433
  • 3
  • 10