xml方式:

在res/drawable中创建一个xml文件(repeat_bg.xml)

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@mipmap/bg_flower"
android:tileMode="repeat" />

代码方式:

ImageView imageView = findViewById(R.id.iv_bg);  
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.mipmap.bg_flower);
BitmapDrawable bd = new BitmapDrawable(bitmap);
bd.setTileModeXY(TileMode.REPEAT , TileMode.REPEAT );
imageView.setBackgroundDrawable(bd);