Changes

A Guide to using ConstraintLayout in Android Studio

10 bytes removed, 17:40, 6 June 2016
Understanding ConstraintLayout Margins
== Understanding ConstraintLayout Margins ==
Constraints can be used in conjunction with margins to implement fixed gaps between a widget and another element (such as another widget, a guideline or the side of the parent layout). Consider, for example, the horizontal constraints applied to the Button object in Figure 18 -12:
[[File:Android studio designer constraint button no bias.png|thumbnail|Opposing constraints without bias]]
Figure 18-12
As currently configured, horizontal constraints run to the left and right edges of the parent ConstraintLayout. As such, the widget has opposing horizontal constraints indicating that the ConstraintLayout layout engine has some discretion in terms of the actual positioning of the widget at runtime. This allows the layout some flexibility to accommodate different screen sizes and device orientation. The horizontal bias setting is also able to control the position of the widget right up to the right-hand side of the layout. Figure 18 -13, for example, shows the same button with 100% horizontal bias applied: