Reputation: 2545
I Imported one image inside the drawable-mdpi, then implemented the image from button, but an error occurs no resource found here
. How do I fix this issue?
I tried this:
main.xml
<Button
android:id="@+id/imageButtonSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable-mdpi/button_focused_orange"/>
Upvotes: 8
Views: 57274
Reputation: 82533
All drawables are compiled under a single resource name, i.e. drawable
. Android automatically chooses from which folder to take the drawable depending on the screen size, and hence you do not need to specifically point it out. Also, hard coding Android to use resources from a particular folder kind of defeats the purpose of having multiple folders for Android to choose from. To solve this issue, simply change:
android:background="@drawable-mdbi/button_focused_orange"/>
To
android:background="@drawable/button_focused_orange"/>
Upvotes: 23
Reputation: 35
You don't have to mention -mdpi to add background images, simply use drawable only. Here is you revised code. Try this.
<Button
android:id="@+id/imageButtonSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_focused_orange"/>
Upvotes: 0
Reputation: 147
Try to clean and rebuild your project. If you are usuing Eclipse you can do this by clicking project -> clean and then project -> Build project
Upvotes: 0
Reputation: 1876
Should be @drawable/button_focused_orange
Not @drawable-mdpi/button_focused_orange
Upvotes: 4