Highlight selected line in RecyclerView

1

How to highlight the selected (clicked) line in recyclerview? The listview was automatic. Thanks in advance.

    
asked by anonymous 11.06.2015 / 03:55

1 answer

0

Hello

I'll assume you're talking about the rippe effect, which is the effect of the image below:

Simplyputtheattributesbelowintotheinflatoparentlayoutbyyouradapter.

android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground"

Example:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:clickable="true"
    android:focusable="true"
    android:background="?attr/selectableItemBackground">
    
14.03.2016 / 13:12