Android之背景图片设置为重复而不是默认的拉伸

在drawable目录下创建一个bitmap_bg.xml:  src是引用图片的名称

1 <?xml version="1.0" encoding="utf-8"?>
2 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
3     android:src="@drawable/ic_launcher"
4     android:tileMode="repeat" >
5 </bitmap>

然后在布局的xml文件中可以这样引用:

1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2     xmlns:tools="http://schemas.android.com/tools"
3     android:layout_width="match_parent"
4     android:layout_height="match_parent"
5     android:background="@drawable/bitmap_bg">
6 </RelativeLayout>
原文地址:https://www.cnblogs.com/maxinliang/p/2973870.html