material-ripple
material-ripple copied to clipboard
Changing color causes Ripple lost
I have the following Ripple in my layout
<com.balysv.materialripple.MaterialRippleLayout
android:id="@+id/ripple"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mrl_rippleColor="@color/green"
app:mrl_rippleAlpha="0.8"
app:mrl_rippleDimension="1dp"
app:mrl_rippleDuration="350"
app:mrl_ripplePersistent="true" >
...
</com.balysv.materialripple.MaterialRippleLayout>
And everything works as expected. By the way I tried to change ripple's color programmatically with the following Java code:
ripple.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selected = !selected;
ripple.setRippleColor(!selected ? white : green);
}
});
At the first tap on my view ripple effect works fine. From the second tap it does not work anymore. Color is changed but ripple effect is not performed.