Last active
August 5, 2017 20:06
-
-
Save StKotok/577ddf0f2b83840d12d7c49256435784 to your computer and use it in GitHub Desktop.
selector for ListView with custom highlight effect. Put in drawable-v21
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
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> | |
<!-- Selected --> | |
<item android:state_focused="true" android:state_pressed="false"> | |
<shape> | |
<solid android:color="#00ffffff" /> | |
</shape> | |
</item> | |
<!-- Pressed --> | |
<item android:state_pressed="true"> | |
<ripple android:color="#55000000" tools:targetApi="lollipop"> <!-- ripple effect color --> | |
<item android:id="@android:id/background"> | |
<shape android:shape="rectangle"> | |
<corners android:radius="6dp" /> | |
<solid android:color="#33ffffff" /> <!-- background color --> | |
</shape> | |
</item> | |
</ripple> | |
</item> | |
</selector> | |
------------- layout.xml --------------- | |
<ListView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:drawSelectorOnTop="true" | |
android:listSelector="@drawable/list_selector" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment