The Chris
The Chris

Reputation: 597

Xamarin.Forms Hamburger Menu Icon gone after Update to Xamarin.Forms 2.2

After I updated my Xamarin.Forms project from Xamarin.Forms 2.0 to Xamarin.Forms 2.2, the Hamburger Icon is gone.

I've googled without luck, has anybody experienced the same issue?

Upvotes: 9

Views: 4132

Answers (3)

Ahune ajé o ahe
Ahune ajé o ahe

Reputation: 141

Please know that the hamburger menu is not shown on IOS builds.

Upvotes: 0

Jannie Theunissen
Jannie Theunissen

Reputation: 30164

Mine was hidden in Android, so I had to write a custom renderer to apply a color and set the opacity to show it again:

[assembly: ExportRenderer(typeof(CustomNavigationPage), typeof(CustomNavigationRenderer))]

namespace App.Droid
{
    public class CustomNavigationRenderer : NavigationPageRenderer
    {

        public CustomNavigationRenderer(Context context) : base(context)
        {
        }

        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            for (var i = 0; i < toolbar.ChildCount; i++)
            {
                var imageButton = toolbar.GetChildAt(i) as ImageButton;

                var hamburger = imageButton?.Drawable as DrawerArrowDrawable;
                if (hamburger == null)
                    continue;

                hamburger.Color = Context.GetColor(Resource.Color.primary_text_default_material_light);
                hamburger.Alpha = 255;
            }


        }
    }
}

Upvotes: 0

Mario Galv&#225;n
Mario Galv&#225;n

Reputation: 4032

If the default icon has disappeared you can set your own icon of the Master page for example:

public class MasterPage : MasterDetailPage
{
    FlyOutMenuPage menu = new FlyOutMenuPage ();
    Master = menu;
}

public class FlyOutMenuPage : ContentPage
{
    Icon = "menu.png";
} 

And menu.png is a resource image, you can get lots of icon from here:

https://www.iconfinder.com/search/?q=hamburger&price=free

Upvotes: 7

Related Questions