android drawable changes sizes on screen when reading image from file

Posted by Daniel Benedykt on Stack Overflow See other posts from Stack Overflow or by Daniel Benedykt
Published on 2010-04-15T14:48:27Z Indexed on 2010/04/15 23:03 UTC
Read the original article Hit count: 141

Filed under:
|
|
|

Hi

I have an image on a private file. I read the file, create the drawable, and assign it to an ImageView. The ImageView has WRAP_CONTENT so the size is automatic.

On 320x480 screens, the image looks good But on screens with more resolution and high density 480x800 or 480x854 (N1, droid) , when the image is for example 150x150, I see the image as 100x100.

Of course it has something to do with the density but not sure how should I resolve this.

This is my code:

FileInputStream fis = this.openFileInput("icon.png");

icon = Drawable.createFromStream(fis, "icon");

fis.close();

imageView.setImageDrawable(icon);

thanks

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk