Designing different screen sizes using ConstraintsLayouts

I began to dive into the Constraints layout, which was announced at IO this year. It looks very promising and makes your layouts very efficient. I have seen codelab escalation provided by Google. However, I have the following questions that I would like to resolve.

  • How can I use ConstraintLayouts to design layouts for different screen sizes?

I am currently developing a layout and setting margin and scroll fields, etc. for a specific group of devices / screens. Save these values ​​in a file dimens.xml. This is a REALLY painful method for developing layouts. Does Android ConstraintsLayout support iOS AutoConstraintsLayout simulation when designing for multiple screens?

  1. When designing a layout for different screen orientations, different Layout.xml ie files are still needed; layout_landscape.xml and layout_portraint.xml?
+4
source share
2 answers

Yes, the whole point of ConstraintLayout (and, what matters, any Android plan with Android 1.0) should be able to handle various screens (dimension, density ...). You have nothing special (other than specifying restrictions between widgets).

If you want to design for different screen sizes, think of borders as a "minimum" interval; and create a restriction between the widgets so that you place the widget relative to other widgets.

, .

, - , , , . , "". . , .

, , , , /, Android Studio:

Screeen popup

, .

enter image description here

+2

ConstraintLayouts ?

, . - layout-sw360dp, layout-sw600dp layout-sw720dp.

.. / . dimens.xml.

.

Layout.xml i-e; layout_landscape.xml layout_portraint.xml?

.

+1

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


All Articles