• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Tiling an image in ImageView

I have an imageview wherein I am dynamically setting an image:

ImageView imgview = (ImageView)findViewById(R.id.img_picture);
imgview
.setImageBitmap(pictureBMP); //pictureBMP is a valid bmp object

The above works fine but the image is a large picture. What I want to do is use the picture as a tile pattern within the imageview.

So I am trying the following:

Bitmap resizedBMP = Bitmap.createScaledBitmap(pictureBMP, 10, 10, false);​
BitmapDrawable bmd =​
new BitmapDrawable(getResources(), resizedBMP);

bmd.setTileModeXY(Shader.TileMode.​
REPEAT, Shader.TileMode.REPEAT);
imgview.setImageDrawable(bmd);

What I see as a result is a very blurred single image of the original. I do not see tiled images inside the imageview.

Any and all advice is well appreciated






 
Back
Top Bottom