How to make android app's background image repeat

Here is a pure-java implementation of background image repeating:

@Override public void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.bg_image);     BitmapDrawable bitmapDrawable = new BitmapDrawable(bmp);     bitmapDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);     LinearLayout layout = new LinearLayout(this);     layout.setBackgroundDrawable(bitmapDrawable); } 

In this case, our background image would have to be stored in res/drawable/bg_image.png.

你可能感兴趣的:(android,image,layout)