[英]Where Should I put the PNG file relate to ImageButton in Android?
I'm very new to Android. 我是Android的新手。
I created a ImageButton. 我创建了一个ImageButton。 The main.xml includes code segment as following.
main.xml包含以下代码段。
<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. 我必须在哪里放置我拥有的“ cat.png”。 Do i need to rename it to something else?
我是否需要将其重命名为其他名称?
Put it in the res/drawable/
folder in your Android project. 将其放在Android项目中的
res/drawable/
文件夹中。 Keep the name cat.png 保留名称cat.png
您只需将其放入任何一个文件夹即可,而无需为此更改xml。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.