先上图:
backrepeat.xml
- <bitmap
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/repeatimg"
- android:tileMode="repeat"
- android:dither="true"/>
代码方式:
- Bitmapbitmap=BitmapFactory.decodeResource(getResources(),R.drawable.icon);
- BitmapDrawablebd=newBitmapDrawable(bitmap);
- bd.setTileModeXY(TileMode.REPEAT,TileMode.REPEAT);
- bd.setDither(true);
- view.setBackgroundDrawable(bd);