How to create Liquid Layout in android

I am participating in a project at the university, I would like to know how I can use the liquid layout in android so that different screen sizes display the application in accordance with its resolution?

In simple words, I would like to create an application whose layout is ideal for all types of screens :)

I know how to create it in simple html / css on sites for PC, but how to do it in Android?

Can anyone give a link to a suggestion / help / tutorial?

Thanks Usman

+6
source share
1 answer

Android provides liquid layouts out of the box - layout sizes and contained elements automatically adapt to screen resolution. It is gracefully handled by the Android platform. There are various types of layouts (LinearLayout, FrameLayout, etc.), so you need to carefully check which type of layout is best for you.

You should avoid AbsoluteLayout. Although true, it allows you to specify the exact location (x / y coordinates) of your children, it is less flexible and more difficult to maintain than other types of layouts without absolute positioning. In any case, it is now not recommended.

Useful links:

Update:

The layout itself will automatically be adapted to different resolutions, but you need to consider that the elements contained in the layout may look different. The same image will be smaller on a high resolution screen than on a low resolution screen. Fortunately, Android offers a way to deal with this problem in a simple way. You can supply different images depending on the resolution that the device has (this is a bit of a simplification because there are other factors, for example, pixel density in addition to resolution). It is likewise possible to supply another layout, but this is not so common.

References:

+6
source

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


All Articles