Force loading required projected dpi based on screen size

I have 4 sets of images

Resolutions DPI Directory 240 x 320 120dpi - drawable-ldpi 320 x 480 160dpi - drawable-mdpi 480 x 800 240dpi - drawable-hdpi 1280x 800 320dpi - drawable-xhdpi 

But when I tested it on an ASUS transformer with a resolution of 1280x800 and DPI 224 . He downloaded the graphics from drawable-hdpi.

If I add another folder called drawable-xlarge, it will load the desired images, but also increase the size of the application.

My questions are as follows

1 - What is the best practice to support all screen sizes and DPI?

2 - Is there a way to force load a certain DPI wrt screen size?

3 - What solution is recommended for my problem without graphics replication?

+4
source share
1 answer

But when I tested it on an ASUS transformer with a resolution of 1280x800 and dpi 224. He downloaded the graphics from drawable-hdpi.

This is because ASUS Transformer is an -hdpi device. Therefore, it works correctly.

What is the best practice to support all screen sizes and dpi?

Usually images change only depending on the density, and therefore your current structure is fine.

If you decide to have images that differ in both screen size and density, you will need to make more directories (e.g. res/drawable-xlarge-hdpi/ ) and images for

Is there a way to force the load on the font size in perticular dpi wrt format?

Density and screen size have nothing to do with each other.

What solution is recommended for my problem without graphics replication?

According to your "question" you have no problems. Therefore, there are no recommendations for your problems.

+3
source

Source: https://habr.com/ru/post/1445770/


All Articles