Toolbar image icons not displaying (Android)

Oregon39 156 Reputation points
2021-03-12T00:45:11.84+00:00

I have the images in the Android project Resources folder. I also tried the assets folder, but that didn't work either. I've tried changing the Build Action setting (AndroidResource, Content, EmbeddedResource etc.) as well as removing the extension of the image in the Xaml. Unfortunately, none of these solution have worked. Other images are working correctly. It seems to be a problem with the toolbar. I've seen some others have this same issue in other forums.

How can I get the image icon, instead of the default text, to show up in the toolbar on Xamarin Forms Android?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,936 Reputation points
    2021-03-12T01:43:34.677+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Hi, @Oregon39 . How did you display the icon on toolbar? I created a basic demo to test the function, it works fine on Android. The image file is placed under Resources\drawable and the BuildAction is the default AndroidResource.

       <ContentPage ...  
           <ContentPage.ToolbarItems>  
               <ToolbarItem IconImageSource="grid_"/>  
           </ContentPage.ToolbarItems>  
           ...  
       </ContentPage>  
    

    Best Regards,

    Jarvan Zhang


    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful