1.把圖片拷貝到res/drawable文件夾.
(@drawable有3個文件夾drawable-hdpi,drawable-ldpi,drawable-mdpi,個人建議3個文件夾都放,因爲這涉及到尺寸,分辨率,編譯的時候它會自適應;@圖片格式是.png)
2.然後修改layout中的main.xml,添加android:background="@drawable/pphf1">,(其中ppf1是我圖片的名稱,自己可以更改)
具體如下:
<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/pphf1">
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/welcome"
android:textColor="8B008B"
/>
</LinearLayout>
運行後的圖片如下:
來自http://blog.sina.com.cn/s/blog_74bcfc9101013syu.html