Images in the 'drawable' folder are resized automatically?

android

Solution

There's really no reason you should ever put a bitmap into the root `drawable` directory. It should typically be used for XML drawables only. Bitmaps in the `drawable` directory will essentially be handled as if they were in `drawable-mdpi` (scaled up proportionally for other densities).

If your goal is to have a bitmap image that is the same pixel size on all densities, you need to put it in `drawable-nodpi`. This will cause it to not be scaled.

Problem

I have a 1280x720px image in the res/drawable folder (not the drawable-hdpi, drawable-ldpi, etc. folder). But at runtime the size is 2560x1440px. How is this possible? Does android resize the images in the drawable folder? Here is the code: ``` Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.start_image_left); int h = bitmap.getHeight(), w = bitmap.getWidth(); ``` I'm testing this on a Motorola Moto G gen2.

Original source