Material Design Ripple/Stay Solid Animation

285 Views Asked by At

Is there anyway to create an animation that once it ripples then it would stay solid color when the contextual actionbar is activated?

1

There are 1 best solutions below

1
On

I was able to sucessfully do this by using an ripple animation combined with a statelistdrawable, example below:

Ripple.xml

 <?xml version="1.0" encoding="utf-8"?>
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/colorPrimary">
    <item android:id="@android:id/mask"
          android:drawable="@android:color/white" />
    <item android:drawable="@drawable/background_selector"/>
 </ripple>

Background_Selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_activated="true" android:drawable="@color/colorPrimaryDark"/>
</selector>