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

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>