How to add actionbar white icon in android

2019-09-12 05:07发布

问题:

I'm trying to add actionbar icon into the android studio and i've do this:

Go to ImageAssets and set the icon for Actionbar and TabIcons and then refer that in menu icon.

But, it's a little bit black when the app compiled, like this:

as you can see, search icon is a little bit black.

So, what is the problem?

I've tried this with copy pasting the icon into drawable(without adding in ImageAssets) and it was white but, it's haven't any good resolution or quality.

How we can add a right or correct way for add actionbar icon like White color action icon into the actionbar?

回答1:

If you want white icon, select CUSTOM theme instead of holo dark or holo white when you import your asset and change color to #FFFFFF, or just manually copy it into drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi and drawable xxxhdpi



回答2:

Solved with android:icon="@drawable/abc_ic_search_api_mtrl_alpha" Private resource

And i think it's an android Studio bug which is when we are adding this, it's a little bit black.