Java – why do some xhdpi phones only display images in / RES / drawable?

This is a scene There are folders:

Drawable LDPI > drawable MDPI > drawable hdpi > drawable xhdpi

Images (usually background, but not limited to such images) are located only in / RES / drawable

I tested the application on galaxy S3 and the background display was correct I tested HTC one X and the background image was not displayed

If I copy the image from / RES / drawable to / RES / drawable xhdpi, one X will display the image

Logically, this shouldn't happen, right? If there are no images in the drawable xhdpi, Android should treat them as other folders until the default / RES / drawable is reached, and should pull them out from there

Why doesn't this happen on some mobile phones?

PS. I noticed the same problems as some tablets, but I don't remember them now

PPS. I mentioned the background image here, but the problem is not limited to this It also happens in other images I know that the xhdpi phone has a big image problem. I don't want you to think that the problem is too big background image It also occurs in other images of "normal" size

Solution

Why put the image file in the drawable folder?

According to the tips I read over the Internet, you should not put image files in a paintable folder

In the drawable folder, only drawable. XML types are placed

If you want to place an image file, place it in any of the following folders (or add additional qualifiers to it, or use other qualifiers):

>Drawable nodpi (only for images whose size you don't know should be) > drawable LDPI > drawable MDPI > drawable hdpi > drawable xhdpi > drawable tvdpi

Images placed in a paintable folder are treated as default, which is MDPI So if you want to keep the file in the same screen density category, put it in the drawable MDPI folder

Another reason why images are not placed in the paintable folder is that Android will automatically convert files to 16 bit images for some devices (such as Samsung Galaxy S), which will make the images look bad in some cases

This is a link to explain this issue

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>