protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_paginaprincipal); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); drawerLayout = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawerLayout.AddDrawerListener(toggle); toggle.SyncState(); navView = FindViewById <NavigationView>(Resource.Id.nav_view); navView.SetNavigationItemSelectedListener(this); Usuario = JsonConvert.DeserializeObject <Usuario>(Intent.GetStringExtra("usuario")); Reproductor = new ReproductorFragment(Usuario, this); base.SupportFragmentManager.BeginTransaction().Add(Resource.Id.content_frame, Reproductor).Hide(Reproductor).Commit(); var bottomNavigation = FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation); bottomNavigation.NavigationItemSelected += (s, e) => { CargarFragmento(e.Item.ItemId); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); toolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.toolbar); drawerLayout = (Android.Support.V4.Widget.DrawerLayout)FindViewById(Resource.Id.drawerLayout); navigationView = (Android.Support.Design.Widget.NavigationView)FindViewById(Resource.Id.navView); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected; //Setup toolbar SetSupportActionBar(toolbar); SupportActionBar.Title = "Topics"; Android.Support.V7.App.ActionBar actionBar = SupportActionBar; actionBar.SetHomeAsUpIndicator(Resource.Drawable.menuaction); actionBar.SetDisplayHomeAsUpEnabled(true); ConnectViews(); // Click event handlers historyLayout.Click += HistoryLayout_Click; engineeringLayout.Click += EngineeringLayout_Click; programmingLayout.Click += ProgrammingLayout_Click; spaceLayout.Click += SpaceLayout_Click; businessLayout.Click += BusinessLayout_Click; geographyLayout.Click += GeographyLayout_Click; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here /* * SetContentView(Resource.Id.DrawerLayoutMenuOne); * drawerLayout = FindViewById<SupportV4DrawerLayout.DrawerLayout>(Resource.Id.DrawerLayoutMenuOne); * navigationView = FindViewById<SupportDesign.NavigationView>(Resource.Id.DrawerLayoutMenuOneNavigationView); * var toolBar = FindViewById<SupportV7ToolBar.Toolbar>(Resource.Id.DrawerLayoutMenuOneToolBar); * * SetSupportActionBar(toolBar); * SupportActionBar.SetDisplayHomeAsUpEnabled(true); * SupportActionBar.SetDisplayShowTitleEnabled(false); * SupportActionBar.SetHomeButtonEnabled(true); * SupportActionBar.SetHomeAsUpIndicator(Resource.Mipmap.HamBurgerWhite); */ try { SetContentView(Resource.Layout.DrawerLayoutMenuOneAXML); drawerLayout = FindViewById <SupportV4DrawerLayout.DrawerLayout>(Resource.Id.DrawerLayoutMenuOne); navigationView = FindViewById <SupportDesign.NavigationView>(Resource.Id.DrawerLayoutMenuOneNavigationView); var toolBar = FindViewById <SupportV7ToolBar.Toolbar>(Resource.Id.DrawerLayoutMenuOneToolBar); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetHomeAsUpIndicator(Resource.Mipmap.HamBurgerWhite); } catch (Exception ex) { var msg = ex.Message; System.Console.Write(ex.StackTrace); } }
//SupportV7ToolBar.Toolbar toolbar; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.DrawerLayoutMenuTwoAXML); drawerLayout = FindViewById <SupportV4DrawerLayout.DrawerLayout>(Resource.Id.MenuTwoDrawerLayout); var toolbar = FindViewById <SupportV7ToolBar.Toolbar>(Resource.Id.MenuTwoToolBar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetHomeAsUpIndicator(Resource.Mipmap.HamBurgerWhite); var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.menu_two_drawer_open, Resource.String.menu_two_drawer_close); drawerLayout.SetDrawerListener(drawerToggle); drawerToggle.SyncState(); navigationView = FindViewById <SupportDesign.NavigationView>(Resource.Id.MenuTowNavigationView); SetupDrawerContent(navigationView); }