title: Creating custom style crashes app
body: <p>I am building my app so that it can benefit from multiple themes.</p>
  
  <p>I have got to the stage where I want to add custom items e.g. </p>
  
  <pre><code>&lt;style name="My.Theme.Default"&gt;
  ...
      &lt;item name="borderColorDialog"&gt;@color/red&lt;/item&gt;
  ...
  &lt;/style&gt;
  
  &lt;style name="My.Theme.Blue"&gt;
  ...
      &lt;item name="borderColorDialog"&gt;@color/blue&lt;/item&gt;
  ...
  &lt;/style&gt;
  </code></pre>
  
  <p>So I've added the attribute <code>borderColorDialog</code> to my attr file as follows:</p>
  
  <pre><code>&lt;attr name="borderColorDialog" format="color" /&gt;
  </code></pre>
  
  <p>Now I want to test it. I have a drawable as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list 
      xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;item&gt;
  
          &lt;shape 
              android:shape="rectangle" &gt;
  
              &lt;solid 
                  android:color="?borderColorDialog" /&gt;
  
          &lt;/shape&gt;
  
      &lt;/item&gt; 
  
      &lt;item
          android:bottom="2dp"&gt;
  
          &lt;shape 
              android:shape="rectangle" &gt;
  
              &lt;solid 
                  android:color="@color/black" /&gt;
  
          &lt;/shape&gt;
  
      &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>This all appears logically sound to me, however the <code>?borderColorDialog</code> reference crashes the emulator:</p>
  
  <pre><code>E/AndroidRuntime(1461): FATAL EXCEPTION: main
  E/AndroidRuntime(1461): java.lang.RuntimeException: Unable to start activity ComponentInfo{.MainActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.android.internal.widget.ActionBarContainer
  E/AndroidRuntime(1461):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
  E/AndroidRuntime(1461):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
  E/AndroidRuntime(1461):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
  E/AndroidRuntime(1461):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
  E/AndroidRuntime(1461):     at android.os.Handler.dispatchMessage(Handler.java:99)
  E/AndroidRuntime(1461):     at android.os.Looper.loop(Looper.java:137)
  E/AndroidRuntime(1461):     at android.app.ActivityThread.main(ActivityThread.java:4745)
  E/AndroidRuntime(1461):     at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime(1461):     at java.lang.reflect.Method.invoke(Method.java:511)
  E/AndroidRuntime(1461):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  E/AndroidRuntime(1461):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  E/AndroidRuntime(1461):     at dalvik.system.NativeStart.main(Native Method)
  E/AndroidRuntime(1461): Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.android.internal.widget.ActionBarContainer
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  E/AndroidRuntime(1461):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2784)
  E/AndroidRuntime(1461):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2844)
  E/AndroidRuntime(1461):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:252)
  E/AndroidRuntime(1461):     at android.app.Activity.setContentView(Activity.java:1867)
  E/AndroidRuntime(1461):     at .MainActivity.onCreate(MainActivity.java:30)
  E/AndroidRuntime(1461):     at android.app.Activity.performCreate(Activity.java:5008)
  E/AndroidRuntime(1461):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
  E/AndroidRuntime(1461):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
  E/AndroidRuntime(1461):     ... 11 more
  E/AndroidRuntime(1461): Caused by: java.lang.reflect.InvocationTargetException
  E/AndroidRuntime(1461):     at java.lang.reflect.Constructor.constructNative(Native Method)
  E/AndroidRuntime(1461):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
  E/AndroidRuntime(1461):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
  E/AndroidRuntime(1461):     ... 24 more
  E/AndroidRuntime(1461): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/actionbar_background.xml from drawable resource ID #0x7f020001
  E/AndroidRuntime(1461):     at android.content.res.Resources.loadDrawable(Resources.java:1918)
  E/AndroidRuntime(1461):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  E/AndroidRuntime(1461):     at android.view.View.&lt;init&gt;(View.java:3336)
  E/AndroidRuntime(1461):     at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:427)
  E/AndroidRuntime(1461):     at android.widget.FrameLayout.&lt;init&gt;(FrameLayout.java:101)
  E/AndroidRuntime(1461):     at android.widget.FrameLayout.&lt;init&gt;(FrameLayout.java:97)
  E/AndroidRuntime(1461):     at com.android.internal.widget.ActionBarContainer.&lt;init&gt;(ActionBarContainer.java:52)
  E/AndroidRuntime(1461):     ... 27 more
  E/AndroidRuntime(1461): Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
  E/AndroidRuntime(1461):     at android.content.res.TypedArray.getColor(TypedArray.java:326)
  E/AndroidRuntime(1461):     at android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:951)
  E/AndroidRuntime(1461):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:881)
  E/AndroidRuntime(1461):     at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:165)
  E/AndroidRuntime(1461):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:881)
  E/AndroidRuntime(1461):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
  E/AndroidRuntime(1461):     at android.content.res.Resources.loadDrawable(Resources.java:1915)
  E/AndroidRuntime(1461):     ... 33 more
  </code></pre>
  
  <p>The error goes on and on. Basically refering to the XML.</p>
  
  <p>Returning it to <code>@color/red</code> works fine.</p>
  
  <p>How can I fix this?</p>