public static void drawerIni(ActionBarActivity context) { FlyOutMenuHelper.m_Drawer = context.FindViewById <DrawerLayout>(Resource.Id.drawer_layout); m_DrawerList = context.FindViewById <ListView>(Resource.Id.flyOutMenu); m_DrawerList.Adapter = new ArrayAdapter <string>(context, Resource.Layout.flyOutMenuItem_view, Sections); //list item click event FlyOutMenuHelper.m_DrawerList.ItemClick += (sender, args) => ListItemClicked(args.Position, context); FlyOutMenuHelper.m_Drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityCompat.Start); //DrawerToggle is the animation that happens with the indicator next to the actionbar FlyOutMenuHelper.m_DrawerToggle = new MyActionBarDrawerToggle(context, m_Drawer, Resource.Drawable.ic_drawer_dark, Resource.String.drawer_open, Resource.String.drawer_close); //Display the current fragments title and update the options menu m_DrawerToggle.DrawerClosed += (o, args) => { /* * SupportActionBar.Title = m_Title; * SupportInvalidateOptionsMenu(); */ }; //Display the drawer title and update the options menu m_DrawerToggle.DrawerOpened += (o, args) => { /* * this.SupportActionBar.Title = this.m_DrawerTitle; * this.SupportInvalidateOptionsMenu(); */ }; //Set the drawer lister to be the toggle. m_Drawer.SetDrawerListener(m_DrawerToggle); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.page_home_view); this.Title = "Home"; this.m_Title = this.m_DrawerTitle = this.Title; this.m_Drawer = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout); this.m_DrawerList = this.FindViewById<ListView>(Resource.Id.left_drawer); this.m_DrawerList.Adapter = new ArrayAdapter<string>(this, Resource.Layout.item_menu, Sections); this.m_DrawerList.ItemClick += (sender, args) => ListItemClicked(args.Position); this.m_Drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityCompat.Start); //DrawerToggle is the animation that happens with the indicator next to the actionbar this.m_DrawerToggle = new MyActionBarDrawerToggle(this, this.m_Drawer, Resource.Drawable.ic_drawer_dark, Resource.String.drawer_open, Resource.String.drawer_close); //Display the current fragments title and update the options menu this.m_DrawerToggle.DrawerClosed += (o, args) => { this.SupportActionBar.Title = this.m_Title; this.SupportInvalidateOptionsMenu(); }; //Display the drawer title and update the options menu this.m_DrawerToggle.DrawerOpened += (o, args) => { this.SupportActionBar.Title = this.m_DrawerTitle; this.SupportInvalidateOptionsMenu(); }; //Set the drawer lister to be the toggle. this.m_Drawer.SetDrawerListener(this.m_DrawerToggle); //if first time you will want to go ahead and click first item. if (savedInstanceState == null) { ListItemClicked(0); } this.SupportActionBar.SetDisplayHomeAsUpEnabled(true); this.SupportActionBar.SetHomeButtonEnabled(true); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); this.title = this.drawerTitle = this.Title; this.drawerLayout = this.FindViewById<DrawerLayout> (Resource.Id.drawer_layout); this.drawerListView = this.FindViewById<ListView> (Resource.Id.left_drawer); //Create Adapter for drawer List this.drawerListView.Adapter = new ArrayAdapter<string> (this, Resource.Layout.item_menu, Sections); //Set click handler when item is selected this.drawerListView.ItemClick += (sender, args) => ListItemClicked (args.Position); //Set Drawer Shadow this.drawerLayout.SetDrawerShadow (Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start); //DrawerToggle is the animation that happens with the indicator next to the actionbar this.drawerToggle = new MyActionBarDrawerToggle (this, this.drawerLayout, this.Toolbar, Resource.String.drawer_open, Resource.String.drawer_close); //Display the current fragments title and update the options menu this.drawerToggle.DrawerClosed += (o, args) => { this.SupportActionBar.Title = this.title; this.InvalidateOptionsMenu (); }; //Display the drawer title and update the options menu this.drawerToggle.DrawerOpened += (o, args) => { this.SupportActionBar.Title = this.drawerTitle; this.InvalidateOptionsMenu (); }; //Set the drawer lister to be the toggle. this.drawerLayout.SetDrawerListener (this.drawerToggle); //if first time you will want to go ahead and click first item. if (savedInstanceState == null) { ListItemClicked (0); } }