Android add other layout in ConstraintLayout using include tag

Android include tag does work with ConstraintLayout, but you need to declare how big is the layout you want to include with the following attributes.

<include
     layout="@layout/content_main"
     android:layout_width="100dp"
     android:layout_height="250dp"
     .../>

For included layout having dynamic height use wrap_content as a value in layout_height or layout_width attributes of include tag.

<include
    android:id="@+id/input_include"
    layout="@layout/task_input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

After that, your constraints should work.


In the constrain layout define the height and width and your constraints as follows:

<include
    app:layout_constraintTop_toBottomOf="@id/custom_members_toolbar_layout"
    app:layout_constraintBottom_toTopOf="@id/file_xfer_bottom_nav_bar"
    android:layout_height="0dp"
    android:layout_width="match_parent"
    layout="@layout/file_xfer_upload_layout"/>

This will auto resize the height based on your constraints.

Cheers!