想让.9的图片平铺显示,一般使用如下
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"android:src="@drawable/bar" android:tileMode="repeat" />
这样在有的设备上会出现不平铺,拉伸显示的问题,故在代码中添加即可
Drawable bg = holder.dot_line.getBackground();if (bg != null) {if (bg instanceof BitmapDrawable) {BitmapDrawable bmp = (BitmapDrawable) bg;bmp.mutate(); // make sure that we aren't sharing state anymorebmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);}}