Only use XHDPI drawables in Android app?

后端 未结 7 901
夕颜
夕颜 2020-12-02 13:01

If you\'re planning to support LDPI, MDPI, HPDI, and perhaps XHDPI in the near future, is it ok to only include XHDPI drawables in the project and let the devices scale them

7条回答
  •  心在旅途
    2020-12-02 13:48

    This statement about extra memory usage is wrong.

    If you put XHDPI sized drawables inside MDPI folder, then you will have memory problems.

    But if you provide XHDPI drawables inside XHDPI folder, then no extra memory will be used since android downsamples the images by skipping parts of it.

    This skipping is the reason why you need to provide drawables for every density you plan to support in order them to look good.

    On the other hand, only certain images will look bad when downsampled (mostly small icons) so as long as the image has enough data to be thrown away, it will look ok. Or imagne if you have a grid as a drawable, so potentialy some grid lines can get thrown away and the image will look bad.

    In the end, it is better for you to experiment with different devices, then you can tell which drawales need alternative resources for their density.

提交回复
热议问题