Skip to content

Instantly share code, notes, and snippets.

@KarthikKumarBA
Created November 24, 2016 10:25
Show Gist options
  • Save KarthikKumarBA/eb9588c6a9763a7815332c5b429e1624 to your computer and use it in GitHub Desktop.
Save KarthikKumarBA/eb9588c6a9763a7815332c5b429e1624 to your computer and use it in GitHub Desktop.
Ripple Effect
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#ColorCode">
<!--Without mask, it will create a cborderless ripple-->
<item android:id="@android:id/mask"
android:drawable="@android:color/white"/>
</ripple>
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#ColorCode">
</ripple>
<!--Add the following attribute to the views whose ripple animation you want to enable
WITH BORDER-->
android:background="?android:attr/selectableItemBackground"
<!--Enable clickable or set onClickListener-->
android:clickable="true"
<!--Add the following attribute to the views whose ripple animation you want to enable
WITHOUT BORDER-->
android:background="?android:attr/selectableItemBackgroundBorderless"
<!--Enable clickable or set onClickListener-->
android:clickable="true"
<!--Conrtols the color of the ripple-->
<item name="colorControlHighlight">#ColorCode</item>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment