I am trying to have something which displays 2 views side by side if there is enough space, or display them vertically on smaller screens like phones in potrait
I have this:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <View
        android:id="@+id/test_view"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="#4f00"
        app:layout_constraintDimensionRatio="1:1"
        app:layout_constraintHeight_max="500dp"
        app:layout_constraintWidth_max="500dp"
        app:layout_constraintWidth_min="150dp" />
    <View
        android:id="@+id/test_view2"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#40f0" />
    <androidx.constraintlayout.helper.widget.Flow
        android:id="@+id/random_flow"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="16dp"
        android:orientation="horizontal"
        app:constraint_referenced_ids="test_view, test_view2"
        app:flow_horizontalGap="16dp"
        app:flow_horizontalStyle="packed"
        app:flow_maxElementsWrap="1"
        app:flow_verticalGap="16dp"
        app:flow_verticalStyle="packed"
        app:flow_wrapMode="chain"
        app:layout_constraintBottom_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
The views are shown in vertical orientation in all screen sizes even when I have specified orientation="horizontal". Looks like they are always wrapping even when there is space to display them horizontally?
I also need test_view (red) to take as much space as available within layout_constraintWidth_max and layout_constraintWidth_min. Looks like it is always using the min.

