I need to fill ConstraintLayout Flow view from Bottom To Top And Right To Left. This is my code:
<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flow"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
app:constraint_referenced_ids="tv1,tv2,tv3,tv4,tv5,tv6,tv7,tv8,tv9,tv10"
app:flow_horizontalGap="8dp"
app:flow_verticalGap="8dp"
app:flow_verticalStyle="packed"
app:flow_wrapMode="chain"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHeight_percent=".5"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
And this is the result:
(In fact I'm going to set references dynamically due to the API response, so assume that the views are not in XML layout)
But I need the below one:
Any help is appreciated.





To arrange items from Bottom-to-Top and Right-to-Left you can use the FlexboxLayout Google Library. All you need is to use the below attributes in FlexboxLayout:
app:flexDirection="column_reverse" This will draw each item from Bottom to Top.
app:flexWrap="wrap_reverse" This will draw each item from Right to Left.
app:justifyContent="flex_start" This will control the alignment of each item and we use
flex_startto align it from bottom.Xml sample is like below:
or Programmatically:
Result: