Reputation: 276
I've seen this ripple color effect on Material Calculator app, on the Google Play and now on the BottomNavigation view.
How can I make this color effect starting from touch?
Upvotes: 0
Views: 2105
Reputation: 276
Both answers do the work but I found a library which simplifies the work when using BottomNavigation:
https://github.com/roughike/BottomBar
Upvotes: 0
Reputation: 2295
I think it will be easier if you use style:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlHighlight">@color/ripple_material_dark</item>
</style>
Upvotes: 3
Reputation:
If you know how to make simple ripple, then here is code to change color of it:
RippleDrawable rippleDrawable = (RippleDrawable)view.getBackground(); // assumes bg is a RippleDrawable
int[][] states = new int[][] { new int[] { android.R.attr.state_enabled} };
int[] colors = new int[] { Color.BLUE }; // sets the ripple color to blue
ColorStateList colorStateList = new ColorStateList(states, colors);
rippleDrawable.setColor(colorStateList);
Upvotes: 1