Nested constraint layouts ignore external constraints
At present, I try to nest two constraint layouts with each other. For this purpose, I use the < include / > label. What I see is that the internal constraint layout ignores all constraints in the external constraint layout. In order to make it more visible, I draw a border around the internal constraint layout:
To try these things, I use COM. Android. Support. Constraint: constraint layout: 1.0.0-alpha3
My question now is: what did I do wrong, or an error in the alpha version?
resolvent:
In order to use < include / > to add attributes to the included layout, you must specify both width and height in the label itself to override or simply confirm the width and height of the root label of the included layout
Example:
<include
layout="@layout/item_place_custom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
This causes the included layout to be restricted to the bottom of its parent layout as expected
This is not unique to the newer constraintlayout. It is the expected behavior of < include / >. It is marked here