Last active
August 29, 2015 14:17
-
-
Save ipereziriarte/c88a268a70cf9d1dc96d to your computer and use it in GitHub Desktop.
Add a Ripple background to a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ListView | |
android:id="@+id/list_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:listSelector="@drawable/my_ripple" | |
android:drawSelectorOnTop="true"/> | |
<!-- drawSelectorOnTop is actually very important: without it the ripple will be drawn under row view --> | |
<!-- Alternative way --> | |
<ListView | |
android:id="@+id/list_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:listSelector="?attr/selectableItemBackground" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="@color/red"> | |
<item | |
android:id="@android:id/mask" | |
android:drawable="@color/red_bg"/> | |
</ripple> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment