Siavash
Siavash

Reputation: 21

Darken Toolbar Color for Statusbar in Android Lollipop

I have different Actionbar (Toolbar) colors in some of my activities. I get the colors from resources and there are HEX.

mToolbar.setBackground(new ColorDrawable(getResources().getColor(CharacterColors[CharID - 1])));

How i can generate a darker version of each color for status bar?

For example i want darken my Toolbar color (#34495e) to (#2a3a4b) and set it as my status bar color.

Upvotes: 1

Views: 1140

Answers (1)

Ahmed Hegazy
Ahmed Hegazy

Reputation: 12605

You would need to write a method yourself unlike standard Java as there is a Color.darker() method.

Check this answer for a working method.

Upvotes: 1

Related Questions