Welcome 微信登录

首页 / 操作系统 / Linux / 如何为Android Activity设置背景图片?

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

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