List of usage examples for android.graphics.drawable BitmapDrawable mutate
@Override
public Drawable mutate()
From source file:Main.java
/** * from http://stackoverflow.com/questions/4336286/tiled-drawable-sometimes-stretches/9500334#9500334 *//* www.java2 s . c o m*/ public static void fixBackgroundRepeat(View view) { Drawable bg = view.getBackground(); if (bg != null) { if (bg instanceof BitmapDrawable) { BitmapDrawable bmp = (BitmapDrawable) bg; bmp.mutate(); // make sure that we aren't sharing state anymore bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); } } }