Why provide multiple drawables for various densities?

后端 未结 4 2164
一向
一向 2021-01-20 06:49

My app supports various screen densities from ldpi to xhdpi. It contains some drawables (images) that need to be displayed properly on all densities. I\'m wondering how many

4条回答
  •  無奈伤痛
    2021-01-20 07:07

    There are several reasons to used prescaled drawables:

    1. Scaling down to lower resolutions takes resources (CPU time, memory and it drains your battery faster), especially if you have a lot of images this might be undesired.

    2. Scaling down a large image might result in worse quality than using a 'pre-tuned' smaller image. Especially if your images are based on a vector original. Or they contain very fine lines or details, which will get lost when due to the scaling.
      For example:
      original image becomes scaled image
      See here for the source of these images and more information on scaling artifacts.

    3. On lower resolutions the image pixels are larger (or the image gets smaller), so it might be required to remove certain aspects of the image to keep it clear/understandable.

提交回复
热议问题