0

I have a recyclerview with items in it. If i click on a item, it does not give any feedback. The backgorund does not get slightly darker like in a listview. This mean I don't know I pressed the item. Is there some default selector available or should I create my own?

Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116

2 Answers2

0

For RecyclerView there is no such parameter as selector in ListView. In Material Theme there are some selectors. I used following attribute attr/listChoiceBackgroundIndicator

 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="@dimen/list_item_height"
     android:foreground="?attr/listChoiceBackgroundIndicator">

It can be set as android:background.

m0rphine
  • 126
  • 4
0

You can try this.. https://stackoverflow.com/a/19780767/3209739
It gives ripple effect. So you can easily realise that you pressed an item.

Community
  • 1
  • 1
cgr
  • 4,578
  • 2
  • 28
  • 52