1. Download our Official Android App: Forums for Android!

Apps Tiling an image in ImageView

Discussion in 'Android Development' started by sree_sundaram, Oct 13, 2010.

  1. sree_sundaram

    sree_sundaram Lurker
    Thread Starter
    Rank:
    None
    Points:
    25
    Posts:
    4
    Joined:
    Sep 8, 2010

    Sep 8, 2010
    4
    0
    25
    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...