I have a simple RecyclerView in which each row displays a line of text. Each row is selectable and so I want to use
android:background="?attr/selectableItemBackground"
The problem is that RecyclerViews do not allow for dividers; whereas I want dividers. Hence I need a background as below (called bottom_line.xml
)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="1dp"
android:color="#FF000000" />
<solid android:color="#00FFFFFF" />
<padding android:left="10dp"
android:right="10dp"
android:top="10dp"
android:bottom="10dp" />
</shape>
</item>
</layer-list>
My question is how do I combine my bottom_line.xml
with ?attr/selectableItemBackground
to create a final drawable with ripples? (I am trying to avoid using a TextView inside a LinearLayout)