【发布时间】:2021-07-21 01:22:21
【问题描述】:
RadioButton 涟漪效应有问题。我想要得到这个:I have ripple in full background of list item
但我有这个:I have ripple only around mark
我该如何实现?
【问题讨论】:
标签: android listview radio-button material-design ripple-effect
RadioButton 涟漪效应有问题。我想要得到这个:I have ripple in full background of list item
但我有这个:I have ripple only around mark
我该如何实现?
【问题讨论】:
标签: android listview radio-button material-design ripple-effect
在 itemView 上应用单击侦听器,并在该侦听器中选中单选按钮 对或错。将 backgroundTint 更改为所需的单选按钮颜色。
【讨论】:
涟漪效果可用于 API 级别 21+,您可以将其应用于单选按钮
android:background="?android:attr/selectableItemBackground" 每个按钮
<RadioGroup
android:id="@+id/radiogroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:text="Option number one" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:text="Option number two" />
</RadioGroup>
【讨论】:
在ListView 中使用CheckedTextView 和SINGLE_CHOICE_MODE 参数。
【讨论】: