-2

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

arayray
  • 241
  • 6
  • 19

1 Answers1

1

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>
arayray
  • 241
  • 6
  • 19