title: styling action bar use a Theme.AppCompat
body: <p>I am following the android training , in styling the Action bar.</p>
  
  <p>I am facing error because of <code>android:theme=@style/MyActionBar</code>.</p>
  
  <p>I want to know how to style the action bar.</p>
  
  <pre><code> &lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/MyActionBar" &gt;
  </code></pre>
  
  <blockquote>
    <p>IllegalStateException: You need to use a Theme.AppCompat theme with
    this activity</p>
  </blockquote>
  
  <p>I thought the error from :</p>
  
  <pre><code>&lt;style name="CustomActionBarTheme"
                 parent="@android:style/Theme.Holo.Light.DarkActionBar"&gt;
              &lt;item name="android:actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt;
          &lt;/style&gt;
  </code></pre>
  
  <p>so I modify it to </p>
  
  <pre><code>&lt;style name="CustomActionBarTheme"
             parent="@android:style/Theme.AppCompat.Light "&gt;
      &lt;item name="android:actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>I had the following error :</p>
  
  <blockquote>
    <p>error: Error retrieving parent for item: No resource found that
    matches the given name '@android:style/Theme.AppCompat.Light '.</p>
  </blockquote>
  
  <p>I created a new file as the training explained</p>
  
  <p>res/values/themes.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
      &lt;!-- the theme applied to the application or activity --&gt;
      &lt;style name="CustomActionBarTheme"
             parent="@android:style/Theme.Holo.Light.DarkActionBar"&gt;
          &lt;item name="android:actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;!-- ActionBar styles --&gt;
  
      &lt;style name="MyActionBar"
         parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"&gt;
      &lt;item name="android:background"&gt;#aaaaaa&lt;/item&gt;
  &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>And here is the manifest </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.helloworld"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="16"
          android:targetSdkVersion="21" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
         android:theme="@style/MyActionBar" &gt;
          &lt;activity
              android:name="com.example.helloworld.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
          android:name="com.example.helloworld.DisplayMessageActivity"
          android:label="@string/title_activity_display_message"
          android:parentActivityName="com.example.Helloworld.MainActivity" &gt;
          &lt;meta-data
              android:name="android.support.PARENT_ACTIVITY"
              android:value="com.example.Helloworld.MyActivity" /&gt;
      &lt;/activity&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>