Android 如何使用ConstraintLayout';布局行中元素的确切数量;s流
我需要布局几对title-value小部件,每对小部件位于一行中,标题与父项的开始对齐,值与父项的结束对齐 项目托管在ConstraintLayout中,我希望使用Flow以所需的方式对齐它们。Android 如何使用ConstraintLayout';布局行中元素的确切数量;s流,android,android-constraintlayout,Android,Android Constraintlayout,我需要布局几对title-value小部件,每对小部件位于一行中,标题与父项的开始对齐,值与父项的结束对齐 项目托管在ConstraintLayout中,我希望使用Flow以所需的方式对齐它们。 我尝试使用Flow的应用程序:Flow\u wrapMode=“aligned”,但这还不够,因为我需要将每个标题都放在一行中。我需要的是一个Flow\u maxementswrap属性: <androidx.constraintlayout.helper.widget.Flow androi
我尝试使用Flow的
应用程序:Flow\u wrapMode=“aligned”
,但这还不够,因为我需要将每个标题都放在一行中。我需要的是一个Flow\u maxementswrap
属性:
<androidx.constraintlayout.helper.widget.Flow
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:constraint_referenced_ids="amountTitle,amount,deliveryTitle,delivery"
app:flow_horizontalStyle="spread_inside"
app:flow_maxElementsWrap="2"
app:flow_wrapMode="aligned" />
<TextView
android:id="@+id/amountTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/amount_title" />
<TextView
android:id="@+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$3.00" />
<TextView
android:id="@+id/deliveryTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/delivery_title" />
<TextView
android:id="@+id/delivery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$1.00" />