I create a simple application "Empty Activity" in Android Studio (Delete TextView from it). Next, I load into the phone, Android Monitor Memory shows that 16.41MB is allocated.

Next, for the main RelativeLayout, I add android: background = "@ drawable / main_window_background" and upload it to the phone, and the Android Monitor Memory shows that 99.87MB has been allocated.

The image "main_window_background.png" has a resolution of 1280x1920. For my reasons: 4 bytes per pixel, 1280 * 1920 * 4 = 9.375MB.

Why is allocated more?

  • They did not notice, if you put some effects on the image, such as a gradient, it takes more even if the number of pixels is the same and the same 32-bit image - Turalllb
  • Although it takes more only as long as it is encoded in some format, but the bitmap is the same size. - Turalllb

0