Tiling an image in ImageView


Last Updated:

  1. sree_sundaram

    sree_sundaram New Member This Topic's Starter

    Joined:
    Sep 8, 2010
    Messages:
    4
    Likes Received:
    0
    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






     

    Advertisement

Share This Page

Loading...