Google has announced a new layout called \"ConstraintLayout\" that\'s supposed to be the ultimate layout, that could replace all of the layouts while stayin
ContraintLayout contains a feature - Chains
- that makes it possible to implement what you are asking:
Chains provide group-like behavior in a single axis (horizontally or vertically).
A set of widgets are considered a chain if they a linked together via a bi-directional connection
Once a chain is created, there are two possibilities:
- Spread the elements in the available space
- A chain can also be "packed", in that case the elements are grouped together
As for your case, you'll have to pack your label
and description
TextViews and center them in you parent vertically:
(make sure you use a version of ConstraintLayout
that supports chains)
Now in constraint layout 1.1.3 we must use app:layout_constraintHorizontal_chainStyle="packed"
instead of app:layout_constraintVertical_chainPacked="true"