protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.NavigationDrawer);
title = drawerTitle = Title;
drawer = FindViewById<Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout);
drawerList = FindViewById<ListView>(Resource.Id.left_drawer);
drawerList.Adapter = new ArrayAdapter<string>(this, Resource.Layout.ItemMenu, Sections);
drawerList.ItemClick += (sender, args) => ListItemClicked(args.Position);
drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, GravityCompat.End); //start
//DrawerToggle is the animation that happens with the indicator next to the actionbar
drawerToggle = new MyActionBarDrawerToggle(this, drawer,
Resource.Drawable.ic_drawer_light,
Resource.String.drawer_open,
Resource.String.drawer_close);
//Display the current fragments title and update the options menu
drawerToggle.DrawerClosed += (o, args) =>
{
SupportActionBar.Title = title;
SupportInvalidateOptionsMenu();
};
//Display the drawer title and update the options menu
drawerToggle.DrawerOpened += (o, args) =>
{
SupportActionBar.Title = drawerTitle;
SupportInvalidateOptionsMenu();
};
//Set the drawer lister to be the toggle.
drawer.SetDrawerListener(drawerToggle);
//if first time you will want to go ahead and click first item.
if (savedInstanceState == null)
{
ListItemClicked(0);
}
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.SetHomeButtonEnabled(true);
}