我在 ChipGroup 中有 Chips,在 HorizontalScrollView 中有这个 ChipGroup。但我的问题是最后一个芯片上的 marginEnd 不起作用!
我尝试以编程方式更改布局参数,但没有成功
<HorizontalScrollView
android:id="@+id/chips_container"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_gravity="center_vertical"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/dividerSmartReplies"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible">
<com.google.android.material.chip.ChipGroup
android:id="@+id/chip_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
app:chipSpacing="8dp"
app:singleLine="true"
app:singleSelection="true">
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_marginStart="8dp"
android:textColor="@color/selector_smart_reply_chip_text"
app:checkedIconVisible="false"
app:chipBackgroundColor="@color/selector_smart_reply_chip"
app:chipCornerRadius="21dp"
app:chipStrokeColor="@color/app_base_blue"
app:chipStrokeWidth="1dp" />
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:textColor="@color/selector_smart_reply_chip_text"
app:checkedIconVisible="false"
app:chipBackgroundColor="@color/selector_smart_reply_chip"
app:chipCornerRadius="21dp"
app:chipStrokeColor="@color/app_base_blue"
app:chipStrokeWidth="1dp" />
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:textColor="@color/selector_smart_reply_chip_text"
app:checkedIconVisible="false"
app:chipBackgroundColor="@color/selector_smart_reply_chip"
app:chipCornerRadius="21dp"
app:chipStrokeColor="@color/app_base_blue"
app:chipStrokeWidth="1dp" />
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_marginEnd="8dp"
android:textColor="@color/selector_smart_reply_chip_text"
app:checkedIconVisible="false"
app:chipBackgroundColor="@color/selector_smart_reply_chip"
app:chipCornerRadius="21dp"
app:chipStrokeColor="@color/app_base_blue"
app:chipStrokeWidth="1dp" />
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
在最后一个芯片之后我需要额外的空间。ChipGroup 的填充工作,但它没有预期 UI 结果。