Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

NavigationClick of android Toolbar not working ?

Hi all,

I have added toolbar in android using appcompact support libarary. and added custom back navigation icon.
but it navigation click is not occuring.
below is my code.

Android.Support.V7.Widget.Toolbar toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
//toolbar.InflateMenu(Resource.Menu.menu);
SetSupportActionBar(toolbar);
toolbar.Title = title;

        toolbar.SetNavigationIcon(Resource.Drawable.back);
        toolbar.NavigationClick += (object sender, Android.Support.V7.Widget.Toolbar.NavigationClickEventArgs e) =>
        {

            Finish();
        };

I am not getting event of NavigationClick.

Please Help

Answers

  • LoriLalondeLoriLalonde CAInsider, University, Developer Group Leader ✭✭✭

    Override the OnOptionsItemSelected event. This is what is triggered when tapping the icon in the Toolbar.

Sign In or Register to comment.