question

EJ-5254 avatar image
0 Votes"
EJ-5254 asked EJ-5254 answered

Xamarin Forms ToolBarItem icon tint color on Android

Hi,

How can I change ToolBarItem icon tint colour on Android? On iOS it's white, but shows black on Android.
For example in below code:

<ContentPage.ToolbarItems>
<ToolbarItem IconImageSource="deleteitem.png"/>
<ToolbarItem IconImageSource="menu_vertical_black.png" />
</ContentPage.ToolbarItems>

dotnet-xamarin
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I used your code, And put my test colorful icon, it do not show black tint, you can see following screenshot.

108888-image.png

Could you share your icon and running screenshot here? Then I can reproduce this issue.

0 Votes 0 ·
image.png (109.2 KiB)

Hi Leon,

Sorry, my icon itself is black colour, but iOS automatically makes it white, I want the same on Android.

109211-menu-vertical-black.png


0 Votes 0 ·
LeonLu-MSFT avatar image
0 Votes"
LeonLu-MSFT answered LeonLu-MSFT edited

Hello,​

Welcome to our Microsoft Q&A platform!

Do you want to achieve the white three dots at the end of toolbar like following screenshot?

109146-image.png

You just add the Order="Secondary" for your <ToolbarItem Order="Secondary"/>

If you do not want to add Order="Secondary", you add a white three dots image directly.

I upload my white white three dots icon here .

↓↓↓↓↓↓(right click-save image here)↓↓↓↓↓

109165-icons8-dots-loading-48.png

(48 px)

109182-icons8-dots-loading-96.png

(96px)



Best Regards,

Leon Lu



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EJ-5254 avatar image
0 Votes"
EJ-5254 answered

Thank you Leon! Order="Secondary" did the trick!

But in general, if I want to add different icon to toolbar, I need to make it's colour white in image file, there is no way to tint it like you can do with Xamarin toolkit and Image or ImageButton?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.