コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            mToolbar = FindViewById <Toolbar>(Resource.Id.mToolbar);
            SetSupportActionBar(mToolbar);
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            this.SupportActionBar.SetHomeButtonEnabled(true);

            mDrawerTitle  = this.Title;
            mPlanetTitles = this.Resources.GetStringArray(Resource.Array.planets_array);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mDrawerList   = FindViewById <RecyclerView>(Resource.Id.left_drawer);

            mDrawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
            mDrawerList.HasFixedSize = true;
            mDrawerList.SetLayoutManager(new LinearLayoutManager(this));

            mDrawerList.SetAdapter(new PlanetAdapter(mPlanetTitles, this));


            mDrawerToggle = new ActionBarDrawerToggle(
                this, mDrawerLayout, mToolbar, Resource.String.drawer_open, Resource.String.drawer_close);

            mDrawerLayout.AddDrawerListener(mDrawerToggle);

            var fragment        = AgendaFragment.NewInstance();
            var fragmentManager = this.SupportFragmentManager;
            var ft = fragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.content_frame, fragment);
            ft.Commit();
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            drawerLayout = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawerLayout);

            drawerToggle = new Android.Support.V7.App.ActionBarDrawerToggle(this, drawerLayout, Resource.String.OpenNavDrawer, Resource.String.CloseNavDrawer);

            drawerLayout.AddDrawerListener(drawerToggle);

            ActionBar.SetDisplayHomeAsUpEnabled(true);

            menuListView            = FindViewById <ListView>(Resource.Id.menuListView);
            menuListView.Adapter    = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Android.Resource.Id.Text1, titles);
            menuListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);
            menuListView.SetItemChecked(0, true);
            OnMenuItemClick(0);
        }
コード例 #3
0
        //IMenuItem menuSearch;
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            StringResource = this.MyApplication.CurrentLangSetting.GetStringResourceContents();
            toolbar        = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            drawer = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout);
            Android.Support.V7.App.ActionBarDrawerToggle toggle = new Android.Support.V7.App.ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);
            drawer.AddDrawerListener(toggle);
            toggle.SyncState();
            leftNav = FindViewById <NavigationView>(Resource.Id.nav_view);
            leftNav.NavigationItemSelected += LeftNav_NavigationItemSelected;

            InitMenuTitle();
            tabLayout = FindViewById <TabLayout>(Resource.Id.tabContent);
            InitTabLayout();
            CURRENT_FRAGMENT = FRAGMENT_TYPE.FRAGMENT_EMPTY;
            SetFragment(FRAGMENT_TYPE.FRAGMENT_CHAT);
            SetMeOnline();
        }