Methods two kinds:
You must first include a background.jpg in the res/drawable directory
Method 1: Create an XML file in Res/drawable (Background_repeat.xml)
Content is
[HTML]View Plaincopy
- <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/background"
- android:tilemode="Repeat"
- />
And then the activity in the XML
[HTML]View Plaincopy
- <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/background_repeat">
Method 2:
[Java]View Plaincopy
- ImageView = (ImageView) Findviewbyid (R.ID.MAINA_IV);
- Bitmap Bitmap = Bitmapfactory.decoderesource (Getresources (), r.drawable.background);
- bitmapdrawable bd = new bitmapdrawable (bitmap);
- Bd.settilemodexy (Tilemode.repeat, tilemode.repeat);
[Java]View Plaincopy
- Imageview.setbackgrounddrawable (BD);
Tile to ImageView or activity background with a small picture tile