Changes

Jump to: navigation, search

A Guide to the Android ConstraintLayout

8 bytes removed, 16:55, 6 June 2016
Baseline Alignment
So far, this chapter has only referred to constraints that dictate alignment relative to the sides of a widget (typically referred to as side constraints). A common requirement, however, is for a widget to be aligned relative to the content that it displays rather than the boundaries of the widget itself. To address this need, ConstraintLayout provides baseline alignment support.
As an example, assume that the previous theoretical layout from Figure 17 -1 requires a TextView widget to be positioned 40dp to the left of the Button. In this case, the TextView needs to be baseline aligned with the Button view. This means that the text within the Button needs to be vertically aligned with the text within the TextView. The additional constraints for this layout would need to be connected as illustrated in Figure 17-5:
[[File:Android constraintlayout two views.png|center|Android ConstraintLayout baseline alignment]]
Figure 17-5
The TextView is now aligned vertically along the baseline of the Button and positioned 40dp horizontally from the Button object’s left hand edge.
== Working with Guidelines ==

Navigation menu