How to set background image for button in android?

Import one image inside drawable-mdpi, then implement the image using the button, but if an error occurs, the resource found here does not appear. How to fix this problem? Please help me

Thanks at Advance

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"/>

enter image description here

+5
source share
4 answers

, .. drawable. Android , , , , . , Android Android . ,

    android:background="@drawable-mdbi/button_focused_orange"/>

    android:background="@drawable/button_focused_orange"/>
+16

@drawable/button_focused_orange

@drawable-mdpi/button_focused_orange

+4

. Eclipse, , → clean, project → Build project

0

-mdpi , drawable. . .

<Button
    android:id="@+id/imageButtonSelector"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/button_focused_orange"/>
0

All Articles