简体   繁体   中英

Where Should I put the PNG file relate to ImageButton in Android?

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?

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

您只需将其放入任何一个文件夹即可,而无需为此更改xml。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM