Answer the question
In order to leave comments, you need to log in
How to adapt android application to different screens?
Good afternoon! The documentation says that you need to create 4 folders: small, normal, large, extra large. And there create layouts for different screens. I wrote an application for a 4.4 inch display and 1080x1920 resolution. It works fine on it. Then I tried to run this application on a 5 inch device with a resolution of 480x854, but for some reason all the elements move out (some even go beyond visibility). Although these two displays are in the same group - large (from 4 to 7.1 inches) I used RelativeLayout and dp everywhere. There are suspicions that one of the displays is narrow and the other is wide - that's why it happens. But how to solve this problem in this case? On stackoverflow, I came across the ConstraintLayout library, can it solve the adaptability problem if I rewrite all layout files for it (at least in the general case)?
Answer the question
In order to leave comments, you need to log in
Or make markup for two types of width (for example, different markups in the layout-w360dp and layout folders)
Or make more fluid markup in one file and check in the studio how it stretches
If everything is leaving you on one screen, but not leaving on the other, then you have laid out crookedly. For example, they set the width in dp without reference to parent containers. Constraint allows you to flatten the hierarchy and not write over 9000 nested containers, but you still have to revise what is laid out.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question