Toolbar item icon is not shown in android

RoyaRoya USMember ✭✭
edited June 14 in Xamarin.Forms

The toolbar item icon has been shown correctly on both Android and iOS devices before updating the xamarin.Forms to the version 4.0.0.0

After updating the xamarin.Forms to version 4.0.0.0, the icon is appeared on iOS but not on Android devices.
I tried in on different android devices with different APIs.

The problem is just the icon because the text is shown correctly.

I have created the toolbar item programmatically as you can see in the following:

        ToolbarItem myTollBar = new ToolbarItem
        {
            Text = "myText",
            IconImageSource = "icon_plus.png",
            Order = ToolbarItemOrder.Primary,
        };


        myTollBar.Clicked += MyTollBar_Clicked;

        ToolbarItems.Add(myTollBar);

P.S.
"Xamarin.Forms" version="4.0.0.425677"
"Xamarin.Android.Support.v7.AppCompat" version="28.0.0.1"

Thank you,

Posts

  • KrissStojKrissStoj USMember

    I have same issue. Once upgrade was made to Xamarin v4.0 the toolbar icons disappeared. They are showing on the Xamarin v3.X. But on v4.0 only text shows, toolbar items still work but the icons is not displayed. Tried anything possible and nothing works. help would be appreciated.

  • RoyaRoya USMember ✭✭
    edited June 27

    @KrissStoj After some search, I found that it causes because of using "FormsApplicationActivity" in your android project, instead, you need to use "FormsAppCompatActivity" which supports the newer Android Material Design layout and API's. So, please try this:

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity

  • RoyaRoya USMember ✭✭
    edited July 16

    This bug has been resolved in the Xamarin Forms 4.1.0

Sign In or Register to comment.