Why provide multiple drawables for various densities?

后端 未结 4 2117
一向
一向 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:04

    Not necessary but for example, you can use different layouts with different drawables for different screen resolutions. You have the option to do it. If you and your users are satisfied with the result, then cool. If you need different behavior in different densities and resolutions, then this feature comes really useful.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-20 07:09

    If you make the scaling down yourself the result might be better compared to auto scaling plus your app doesnt consume resources for scaling if the drawables are prepared.

    0 讨论(0)
  • 2021-01-20 07:22

    Your assumption about scaling resources isn't correct. Some large images may still look nice when they are scaled down, but this isn't the general case. If the image has smooth transitions and no gradients, it will be nicely scaled down. Images that contain sharp transitions or contain text for example will look ugly in lower resolutions.

    0 讨论(0)
提交回复
热议问题