This question has already been answered:

The bottom line is that there is a layout which consists of different images. It is necessary to display it on the screen. Using DP does not help, as it begins to specifically move out. I wrote my own class which resizes images by pixels, that is, it takes a coefficient for a given screen relative to standard images and samples and redraws them. But this approach eats a lot of RAM. Who will tell?

Reported as a duplicate by pavlofff , cheops , aleksandr barakin , YuriySPb android 12 Jun '16 at 23:16 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • four
    Learn to impose a "rubber" (adaptive) design. About how to do this, you can write a book :) Pixel-by-pixel pictures are a dead end - under the android a huge number of devices with a variety of screen sizes, resolutions and densities - you can’t cut everything. - pavlofff

1 answer 1

I think that you said farewell to dp too easily and simply, and this unit of measurement needs a little more attention to make it work the way you want.

I recommend to take into account the fundamentals principles that are caused by modifiers in the resources and it is really very convenient:

1. Screen size.

2. Screen Density.

3. Screen resolution.

4. Screen Orientation.

You can open DashboardAndroid and see which parameters are more popular now and work initially from under them, having already captured most of the market in advance.

Moreover, without using this approach, you lose many design principles. Because on different screens, on different devices - the interface should look identical, BUT! for this, it is sometimes necessary to move almost all elements or even add new ones. (phone / tablet / tv / wear) What is also easy to consider modifiers, the choice is yours.