Why don't some xhdpi mobiles display image located in /res/drawable only?

后端 未结 2 1864
时光取名叫无心
时光取名叫无心 2021-02-08 20:14

This is a scenario. There are folders:

  • drawable
  • drawable-ldpi
  • drawable-mdpi
  • drawable-hdpi
  • draawble-xhdpi

An imag

2条回答
  •  攒了一身酷
    2021-02-08 20:53

    why do you want to put an image file into the drawable folder ?

    according to tips i've read over the internet , you should not put images files in the drawable folder .

    in the drawable folder you put only xml type drawables.

    if you want to put an image file , put it in any of the following folders (or add an additional qualifier for them , or use other qualifiers ) :

    • drawable-nodpi (only for images that you don't know what should be their size)
    • drawable-ldpi
    • drawable-mdpi
    • drawable-hdpi
    • drawable-xhdpi
    • drawable-tvdpi

    images that are put into the drawable folder are treated as default , which is mdpi . so if you want to keep the file in the same screen density category , put it into the drawable-mdpi folder.

    another reason for not putting an image into the drawable folder is that android will automatically convert the file to 16 bit image for some devices (like the samsung galaxy s) , which will make the image look awful on some cases.

    here's a link that explains this issue .

提交回复
热议问题