'PIcture size 4 times actual image
I'm making an Android game.
I loaded a 128x240 PNG image with my sprites into a Bitmap object and tried to retrieve a 16x16 tile from it via createBitmap(bitmap, x, y, w, h), but got a 1/4 smaller section of the picture instead.
The width/height of the picture according to getWidth/getHeight is 512x960.
What am I doing wrong?
Solution 1:[1]
Probably you have the picture in your drawable folder and testing it on a device with high resolution? Android automatically scales up pictures according to http://developer.android.com/guide/practices/screens_support.html
I think the quick solution is to put the image to a drawable-xhdpi (or according other drawable folder).
EDIT: based on a comment at I don't want Android to resize my bitmap Automatically, you can add a folder "drawable-nodpi" to prevent the resizing
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
