Search code examples
androidandroid-layoutandroid-xmlandroid-constraintlayoutandroidx

How to align elements using ConstraintLayout Flow


I am using ConstraintLayout Flow want to create layout like belowenter image description here

But not able to achieve above using ConstraintLayout Flow my layout looks like below

enter image description here

Below is my code

        <androidx.constraintlayout.helper.widget.Flow
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imgAiport"
        app:constraint_referenced_ids="tvDateLbl,tvTimeLbl,tvAirlineLbl,tvDate,tvTime,imgAirlineLogo"
        app:flow_wrapMode="aligned"
        android:layout_margin="15dp"
        app:flow_maxElementsWrap="3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

How to correctly align elements using ConstraintLayout Flow


Solution

  • I think the only options here is to make all these TextView's to one width size with text gravity to the start.