title: XML buttons that call XML drawables
body: <p>I have a series of images on drawable folder that I want to reuse in a language folder (drawable-pt) so I created an xml file for each image in the language folder like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;bitmap xmlns:android="http://schemas.android.com/apk/res/android"
      android:src="@drawable/habitat_over" /&gt;
  </code></pre>
  
  <p>then I have in a xml folder a xml file that represents button states:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:state_pressed="true"
              android:drawable="@drawable/habitat_over"/&gt;
      &lt;item android:drawable="@drawable/habitat" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>in the layout I have something like this:</p>
  
  <pre><code>&lt;ImageButton android:layout_weight="1" 
  android:background="@null" 
  android:layout_width="wrap_content" 
  android:src="@xml/habitat_button" 
  android:id="@+id/habitat" 
  android:layout_height="wrap_content" 
  android:scaleType="fitCenter"&gt;
  &lt;/ImageButton&gt;
  </code></pre>
  
  <p>It should work but when I run the application this error shows up:</p>
  
  <pre><code>Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class &lt;unknown&gt;
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.createView(LayoutInflater.java:518)
  
  E/AndroidRuntime(  409):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  
  E/AndroidRuntime(  409):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
  
  E/AndroidRuntime(  409):    at android.app.Activity.setContentView(Activity.java:1657)
  
  E/AndroidRuntime(  409):    at pnm.freiramadeira.ChapterSelection.onCreate(ChapterSelection.java:90)
  
  E/AndroidRuntime(  409):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  
  E/AndroidRuntime(  409):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  
  E/AndroidRuntime(  409):    ... 11 more
  
  E/AndroidRuntime(  409): Caused by: java.lang.reflect.InvocationTargetException
  
  E/AndroidRuntime(  409):    at java.lang.reflect.Constructor.constructNative(Native Method)
  
  E/AndroidRuntime(  409):    at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
  
  E/AndroidRuntime(  409):    at android.view.LayoutInflater.createView(LayoutInflater.java:505)
  
  E/AndroidRuntime(  409):    ... 25 more
  
  E/AndroidRuntime(  409): Caused by: android.content.res.Resources$NotFoundException: File res/xml/habitat_button.xml from drawable resource ID #0x7f050007
  
  E/AndroidRuntime(  409):    at android.content.res.Resources.loadDrawable(Resources.java:1697)
  
  E/AndroidRuntime(  409):    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  
  E/AndroidRuntime(  409):    at android.widget.ImageView.&lt;init&gt;(ImageView.java:118)
  
  E/AndroidRuntime(  409):    at android.widget.ImageButton.&lt;init&gt;(ImageButton.java:85)
  
  E/AndroidRuntime(  409):    at android.widget.ImageButton.&lt;init&gt;(ImageButton.java:81)
  
  E/AndroidRuntime(  409):    ... 28 more
  
  E/AndroidRuntime(  409): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-pt/habitat_over.xml from drawable resource ID #0x7f02002f
  
  E/AndroidRuntime(  409):    at android.content.res.Resources.loadDrawable(Resources.java:1697)
  
  E/AndroidRuntime(  409):    at android.content.res.Resources.getDrawable(Resources.java:581)
  
  E/AndroidRuntime(  409):    at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:162)
  
  E/AndroidRuntime(  409):    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:787)
  
  E/AndroidRuntime(  409):    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:728)
  
  E/AndroidRuntime(  409):    at android.content.res.Resources.loadDrawable(Resources.java:1694)
  
  E/AndroidRuntime(  409):    ... 32 more
  
  E/AndroidRuntime(  409): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: &lt;bitmap&gt; requires a valid src attribute
  
  E/AndroidRuntime(  409):    at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:375)
  
  E/AndroidRuntime(  409):    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:787)
  
  E/AndroidRuntime(  409):    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:728)
  
  E/AndroidRuntime(  409):    at android.content.res.Resources.loadDrawable(Resources.java:1694)
  
  E/AndroidRuntime(  409):    ... 37 more
  </code></pre>
  
  <p>Does anyone knows why this happens??</p>
  
  <p>Thanks in advance!!</p>