I have a view with like this
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:background="@drawable/ripple"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
And ripple.xml as
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight" >
<item android:id="@android:id/mask"
android:drawable="@android:color/white" />
</ripple>
Everything works great. When i touch the view it gives me Ripple Effect. What i am looking for is to start the ripple animation on the view from code repeatedly. To show it as a indeterminate progress. So waves keeps on rippling.
Something like
Runnable runnable = new Runnable() {
@Override
public void run() {
RippleDrawable drawable = (RippleDrawable) button.getBackground();
drawable.showRipples(true, true); // <-- This is needed
handler.postDelayed(runnable, 500);
}
};
How to do this?