Home > Software design >  Xamarin Forms ToolbarItem text (only) not displaying on Android (only)
Xamarin Forms ToolbarItem text (only) not displaying on Android (only)

Time:12-02

I have a working Xamarin Forms app for Android and UWP. (Have not yet attempted iOS.) I have the following ToobarItem:

<ContentPage Title="Debug" ...  >

    <ContentPage.ToolbarItems>
        <ToolbarItem IconImageSource="Question_16x.png" Text="Help" Clicked="OnHelpPressed" Order="Primary" Priority="0"/>
    </ContentPage.ToolbarItems>
...

On UWP it works as I would expect: enter image description here

But on Android, either the Android simulator or a Samsung phone, I get just a very muddy question mark icon and no text "Help": enter image description here

If I remove the icon the text displays.

On both platforms clicking or tapping the item drives the Clicked method as expected. Exact same icon in both projects.

Any suggestions?

CodePudding user response:

On android/ios, you could use code below to display text and icon:

   <ContentPage.ToolbarItems>
        <ToolbarItem IconImageSource="Question_16x.png" Order="Primary" Priority="0"/>
     <ToolbarItem Text="Help"Clicked="OnHelpPressed" Order="Primary" Priority="0"/>
    </ContentPage.ToolbarItems>
  • Related