RadioButton in ListView ripple effect

445 views Asked by At

I have problem with RadioButton ripple effect. I want get this: I have ripple in full background of list item

but I have this: I have ripple only around mark

How can I implement this?

3

There are 3 answers

0
Виталий Туренко On BEST ANSWER

Use CheckedTextView in ListView with SINGLE_CHOICE_MODE parameter.

1
Zain On

Ripple effect is available for API-level 21+ you can apply it to Radio buttons with android:background="?android:attr/selectableItemBackground" for each individual button

<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>
1
Umer Iqbal On

Apply click listener on itemView and in that listener check radio button as true or false. Change the backgroundTint to required color of radio button.