elmontoya7
elmontoya7

Reputation: 276

BottomNavigation view ripple color effect

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?

Gif: https://d13yacurqjgara.cloudfront.net/users/72535/screenshots/2673294/bottom_navigation_material_design_by_jardson_almeida.gif

enter image description here

Upvotes: 0

Views: 2105

Answers (3)

elmontoya7
elmontoya7

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

Abhi
Abhi

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

user7237624
user7237624

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

Related Questions