我有RadioButton
涟漪效应的问题。我想得到这个:我在列表项的完整背景中有波纹
但我有这个:我只在标记周围有波纹
我该如何实施?
在 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>
与参数一起使用CheckedTextView
。ListView
SINGLE_CHOICE_MODE