I have defined a ConstraintLayout
which contains a Flow
virtual layout which tightly wraps and vertically stacks three views, as follows:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/view1"
android:layout_width="150dp"
android:layout_height="50dp"
android:background="@android:color/black" />
<View
android:id="@+id/view2"
android:layout_width="100dp"
android:layout_height="50dp"
android:background="@android:color/black" />
<View
android:id="@+id/view3"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@android:color/black" />
<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="view1,view2,view3"
app:flow_horizontalAlign="start"
app:flow_horizontalStyle="packed"
app:flow_maxElementsWrap="1"
app:flow_verticalAlign="top"
app:flow_verticalGap="8dp"
app:flow_verticalStyle="packed"
app:flow_wrapMode="chain"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Despite the flow_horizontalAlign
value of start
, this renders the views as horizontally centred, as follows:
Does anyone know how I can start/left align the referenced views instead?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…