Why is my bitmap being re-sized in Android?
Very new to Android development, and I am importing 开发者_运维百科a bitmap that is 799 in width. However, when I bring the bitmap into Android, it is saying the bitmap is now 533 in width. Is there a reason for that?
Here's the code I'm using:
Bitmap texture = BitmapFactory.decodeResource(getResources(),R.drawable.image);
Preferably, I'd like to have the image be the same size as when I originally created it. That way I know ahead of time what I'm dealing with rather than checking again what the code has done to the image.
Put
<supports-screens android:anyDensity="true" />
into your manifest, see if that fixes the problem without the drawable-nodpi folder.
Hmm...well, I think I solved my own problem though I don't comprehend it. I changed my image to be stored in the source folder res/drawable-nodpi, and now there's no scaling.
Guess I have to investigate what those different folders mean and how to deal with it in my code.
精彩评论