big papi
big papi

Reputation: 51

How to change the color of bottom navigation bar tap animation?

As you can see in this gif: https://gyazo.com/fc2f8e8ae9fbdae1b06d88336e76bc05

When an icon is tapped, an animation is played which is a green color. By default this color is gray. How can I change it to a different color?

Upvotes: 1

Views: 2072

Answers (3)

Domingo Wen
Domingo Wen

Reputation: 1

You should try to use app:itemBackground="@null" in XML.

Upvotes: 0

LAMRIN TAWSRAS
LAMRIN TAWSRAS

Reputation: 302

You can do it with your event. Like when you click the event then change source or transparent color of bottom bar actions.

Changing drawable can be a good option.

Upvotes: 1

shiftpsh
shiftpsh

Reputation: 1926

For ripples you can specify colorControlHighlight for API 21 or higher.

Add this line to your res/values-v21/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="...">
        ...
        <item name="colorControlHighlight">[desired color]</item>
        ...
    </style>
</resources>

Replace [desired color] with your color, or a color resource, such as #009688 or @color/color_control_highlight. That'll default all ripple animations to the desired color.

Upvotes: 5

Related Questions