Image Pixelation (PNG)

by nimph » Sat, 05 Sep 2009 09:44:16 GMT


Sponsored Links
 I'm trying to load a PNG image into an ImageView using the following
code:

    mImageView.setImageBitmap(BitmapFactory.decodeStream(getClass().
           getResourceAsStream("file_name.png")));

The images are displayed just fine, but they are badly pixelated.

Putting the images in 'res/drawables' works fine, I only see this with
images loaded from the file-system.

What am I doing wrong?  Let me know if you need more info.

Thanks,
--~--~---------~--~----~------------~-------~--~----~



Image Pixelation (PNG)

by String » Sat, 05 Sep 2009 11:35:07 GMT


 I've had this problem if the size of the ImageView doesn't exactly
match the dimensions of the bitmap in the file.

String



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Image Pixelation (PNG)

by nimph » Sun, 06 Sep 2009 12:46:43 GMT


 Thanks, had not tried that, but...  No luck...

I tried adding the following to the ImageView.

    android:maxHeight="32px" android:maxWidth="32px"
android:minHeight="32px"
                android:minWidth="32px"

Are these the attributes you set?

//




--~--~---------~--~----~------------~-------~--~----~