5

I'm very new to Android.

I created a ImageButton. The main.xml includes code segment as following.

<ImageButton
android:id="@+id/button1"
android:layout_width="50px"
android:layout_height="50px"
android:src="@drawable/cat"
android:layout_x="50px"
android:layout_y="52px"
>

Where do i have to put the "cat.png" i have. Do i need to rename it to something else?

Mudassir
  • 13,031
  • 8
  • 59
  • 87
dinesh707
  • 12,106
  • 22
  • 84
  • 134

2 Answers2

2

Put it in the res/drawable/ folder in your Android project. Keep the name cat.png

Simon Dorociak
  • 33,374
  • 10
  • 68
  • 106
Eric Nordvik
  • 14,656
  • 8
  • 42
  • 50
  • there are 3 folders. drawable-hdpi, drawable-ldpi, drawable-mdpi ? do i need to put it for all 3? or do i need to change the xml code? – dinesh707 Mar 03 '11 at 11:57
  • It depends on if you want it to be different resolution for the different screen dpis. Make it a high-resolution image with 240dpi for hdpi, 160dpi for mdpi and 120dpi for ldpi. – Eric Nordvik Mar 03 '11 at 11:59
0

you can simply put in any one folder it will work no need to change xml for that.

Sumant
  • 2,775
  • 2
  • 22
  • 30