Is there anyway to create an animation that once it ripples then it would stay solid color when the contextual actionbar is activated?
Asked
Active
Viewed 275 times
1 Answers
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
-
Good. I think its because Ripple Drawable extends LayerDrawable so that this works! – Morty Choi Jul 27 '15 at 08:41