Reputation: 694
at the moment I'm trying to nest two Constraint Layouts in each other. For that I use the <include/>
tag. What I see there is that the inner Constraint Layout ignores every constraints from the outer Constraint Layout. For making that more visible I draw a border around the inner Constraint Layout:
For trying that stuff I use the com.android.support.constraint:constraint-layout:1.0.0-alpha3
.
My Question is now: did I do something wrong or is it even a bug from the alpha version?
Upvotes: 3
Views: 2845
Reputation: 1632
In my case, inner <include>
layout has merge as parent. I changed it to Framelayout, and it solved the problem!
Upvotes: -1
Reputation: 51
In order to add attributes to an included layout using the <include/>
tag, you must specify BOTH width and height in the tag itself overriding or simply confirming those of the root tag 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 results in the included layout being constrained to the bottom of its parent layout as expected.
This is not exclusive to the newer ConstraintLayout, this is the expected behavior of the <include/>
tag as mentioned here
Upvotes: 5