1,背景图片资源:放在工程目录\res\drawable,命名为bk.png

2,修改main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bk"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>3,效果图

本文介绍如何在Android应用中设置背景图片,包括将图片资源放置于正确目录、修改布局文件main.xml来引用该图片资源,并展示最终效果。
1815

被折叠的 条评论
为什么被折叠?



