当前位置: 首页>>代码示例>>C#>>正文


C# DrawerLayout类代码示例

本文整理汇总了C#中DrawerLayout的典型用法代码示例。如果您正苦于以下问题:C# DrawerLayout类的具体用法?C# DrawerLayout怎么用?C# DrawerLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DrawerLayout类属于命名空间,在下文中一共展示了DrawerLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            int calcNo = Intent.GetIntExtra("CalculationType",-1);

            SetContentView (Resource.Layout.PercentDrawer);

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);
            drawerLayout.SetBackgroundColor(Android.Graphics.Color.AntiqueWhite);
            ColorDrawable colorDrawable = new ColorDrawable (Color.Black);
            this.ActionBar.SetBackgroundDrawable (colorDrawable);

            drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);

            drawerLayout.SetDrawerListener (drawerToggle);

            drawerListView = FindViewById<ListView> (Resource.Id.drawerListView);
            drawerListView.Adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1, calculationTitles);
            drawerListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);
            drawerListView.SetItemChecked (calcNo, true);
            OnMenuItemClick (calcNo);

            ActionBar.SetDisplayHomeAsUpEnabled (true);
        }
开发者ID:vkroust,项目名称:Calculate-Percent,代码行数:25,代码来源:PercentDrawer.cs

示例2: InitUI

        void InitUI()
        {
            mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawerLayout);
            mDrawerList = FindViewById<ListView> (Resource.Id.sliderMenu);

            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, operations);
            mDrawerList.Adapter = adapter;

            ActionBar.SetDisplayHomeAsUpEnabled (true);
            ActionBar.SetHomeButtonEnabled (true);

            mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                Resource.Drawable.ic_drawer, //nav menu toggle icon
                Resource.String.app_name, // nav drawer open - description for accessibility
                Resource.String.app_name // nav drawer close - description for accessibility
            );

            mDrawerLayout.DrawerClosed += (sender, e) => {
                ActionBar.Title = Resources.GetString(Resource.String.app_name);
                InvalidateOptionsMenu();
            };

            mDrawerLayout.DrawerOpened += (sender, e) => {
                ActionBar.Title = Resources.GetString(Resource.String.app_name);
                InvalidateOptionsMenu();
            };

            mDrawerLayout.SetDrawerListener(mDrawerToggle);

            //FragmentManager.BeginTransaction ().Replace (Resource.Id.container, new ServiceFragment ()).Commit ();
            //FragmentManager.BeginTransaction ().Replace (Resource.Id.container, new LinearFragment ()).Commit ();
            FragmentManager.BeginTransaction ().Replace (Resource.Id.container, new EditTextSampleFragment ()).Commit ();
        }
开发者ID:ramanan-java,项目名称:AXSample,代码行数:33,代码来源:MainActivity.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            fragmentManager = FragmentManager;
            //fragmentManager.AddOnBackStackChangedListener(this);

            registerFragments(bundle);
            SetContentView(Resource.Layout.activity_home);

            drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer);

            toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                drawerToggle = new MvxActionBarDrawerToggle(
                    this,                  /* host Activity */
                    drawerLayout,         /* DrawerLayout object */
                    toolbar,  /* nav drawer icon to replace 'Up' caret */
                    Resource.String.drawer_open,  /* "open drawer" description */
                    Resource.String.drawer_close  /* "close drawer" description */
                );

                drawerLayout.SetDrawerListener(drawerToggle);
            }

            ViewModel.ShowMenu ();
        }
开发者ID:CecileRobertMichon,项目名称:Xam.NavDrawer,代码行数:30,代码来源:HomeActivity.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource.
            SetContentView(Resource.Layout.Main);
            _DrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerMain);

            // Set the toolbar
            _Toolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);

            _DrawerToggle = new HelpsAppCompatDrawerToggle(this, _DrawerLayout, Resource.String.menuTitle, _CurrentViewTitle);
            _DrawerLayout.SetDrawerListener(_DrawerToggle);

            // Set up action bar
            SetUpSupportActionBar(bundle);
            
            _DrawerToggle.SyncState();

            // Set up the menu layout.
            SetUpMenu();
            
            //Fetch booking data
            FetchBookingData();

        }
开发者ID:HamzaTariq95,项目名称:HELPSProject,代码行数:26,代码来源:MainActivity.cs

示例5: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.CreateEmployee);

            _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.createemployee, this);

            BtnCreateEmployee = FindViewById<Button>(Resource.Id.ButtonCreateEmployee);        
            EditTextFirstName = FindViewById<EditText>(Resource.Id.EditTextFirstName);
            EditTextLastName = FindViewById<EditText>(Resource.Id.EditTextLastName);
            EditTextEmployeeID = FindViewById<EditText>(Resource.Id.EditTextEmployeeID);
            EditTextEmail = FindViewById<EditText>(Resource.Id.EditTextEmail);
            SpinnerDepartment = FindViewById<Spinner>(Resource.Id.SpinnerDepartment);
            SpinnerPrivledge = FindViewById<Spinner>(Resource.Id.SpinnerPrivledgeLevel);
            Color color = new Color(ContextCompat.GetColor(this, Resource.Color.black)); 
            SpinnerDepartment.Background.SetColorFilter(color,PorterDuff.Mode.SrcAtop);
            SpinnerPrivledge.Background.SetColorFilter(color, PorterDuff.Mode.SrcAtop);

            BtnCreateEmployee.Click += async delegate
            {
                BtnCreateEmployee.Enabled = false;
                await createEmployee();
                BtnCreateEmployee.Enabled = true;
            };
        }
开发者ID:ititwcip,项目名称:ITWCIPApplication,代码行数:30,代码来源:CreateEmployeeActivity.cs

示例6: HelpsAppCompatDrawerToggle

 public HelpsAppCompatDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource)
     : base(host, drawerLayout, openedResource, closedResource)
 {
     _HostActivity = host;
     _OpenedResource = openedResource;
     _ClosedResource = closedResource;
 }
开发者ID:HamzaTariq95,项目名称:HELPSProject,代码行数:7,代码来源:HelpsAppCompatDrawerToggle.cs

示例7: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource.
            SetContentView(Resource.Layout.Main);

            // Check if we're using a layout with a navigation drawer. If yes, set it up.
            this.drawerLayout = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            if (this.drawerLayout != null)
            {
                this.drawerMenu = this.FindViewById<FrameLayout>(Resource.Id.mainContainer);
                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);
                this.drawerToggle = new ActionBarDrawerToggle(this, this.drawerLayout, Resource.Drawable.ic_drawer_light, Resource.String.DrawerOpen, Resource.String.DrawerClose);
                this.drawerLayout.SetDrawerListener(this.drawerToggle);
                this.drawerLayout.OpenDrawer (this.drawerMenu);
            }

            // Populate the menu with a fragment. This can either be the full screen (phone), the left part (10 inch tablet)
            // or the content of the navigation drawer (7 inch tablet).
            var fragment = new CountryListFragment();
            var transaction = this.FragmentManager.BeginTransaction();

            transaction.Replace(Resource.Id.mainContainer, fragment);
            transaction.Commit();
        }
开发者ID:Krumelur,项目名称:AndroidRotationAndScreenSize,代码行数:26,代码来源:MainActivity.cs

示例8: OnCreate

		protected override void OnCreate (Android.OS.Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.Main);
			Toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
			drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
			if (Toolbar != null) {
				SetSupportActionBar (Toolbar);
				SupportActionBar.SetDisplayHomeAsUpEnabled (true);
				SupportActionBar.SetHomeButtonEnabled (true);
			}

			var navigationDrawer = this.FindViewById<NavigationView> (Resource.Id.nav_view);
			navigationDrawer.NavigationItemSelected += Nv_NavigationItemSelected;

			// animating menu
			actionBarToggle = new ActionBarDrawerToggle (
				this, 
				drawerLayout, 
				Resource.String.openDrawer,
				Resource.String.closeDrawer
			);



			drawerLayout.SetDrawerListener (actionBarToggle);
			actionBarToggle.SyncState ();
			DoFirstRun (savedInstanceState);
		}
开发者ID:codeRuth,项目名称:Ask-X,代码行数:29,代码来源:MainActivity.cs

示例9: OnCreate

		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			setup();

			// Set our view from the "main" layout resource
			SetContentView(Resource.Layout.Main);

			drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
			drawerList = FindViewById<RecyclerView>(Resource.Id.left_drawer);

			drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
			drawerList.SetLayoutManager(new LinearLayoutManager(this));
			adapter = new MenuAdapter();
			drawerList.SetAdapter(adapter);

			// enable ActionBar app icon to behave as action to toggle nav drawer
			this.ActionBar.SetDisplayHomeAsUpEnabled(true);
			this.ActionBar.SetHomeButtonEnabled(true);
			this.ActionBar.Title = "Test";
			drawerToggle = new MainDrawerToggle(this, drawerLayout,
				Resource.Drawable.ic_drawer,
				Resource.String.drawer_open,
				Resource.String.drawer_close);

			drawerLayout.AddDrawerListener(drawerToggle);

			drawerLayout.CloseDrawer(drawerList);
			vm.NavigatedTo(null);
		}
开发者ID:holtsoftware,项目名称:House,代码行数:31,代码来源:MainActivity.cs

示例10: ActionBarDrawerToggle

 public ActionBarDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource)
     : base(host, drawerLayout, openedResource, closedResource)
 {
     _activity = host;
     _openedResource = openedResource;
     _closedResource = closedResource;
 }
开发者ID:Supermortal,项目名称:RiffSharer,代码行数:7,代码来源:ActionBarDrawerToggle.cs

示例11: OnCreate

		protected override void OnCreate (Bundle savedInstanceState)
		{ 
 
			base.OnCreate (savedInstanceState);   
			SetContentView (Resource.Layout.Main);
			drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); 

			// Init toolbar
			var toolbar = FindViewById<Toolbar>(Resource.Id.app_bar);
			SetSupportActionBar(toolbar);
			SupportActionBar.SetTitle (Resource.String.app_name);
			SupportActionBar.SetDisplayHomeAsUpEnabled(true);
			SupportActionBar.SetDisplayShowHomeEnabled(true);

			// Attach item selected handler to navigation view
			var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
			navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

			// Create ActionBarDrawerToggle button and add it to the toolbar
			var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);
			drawerLayout.SetDrawerListener(drawerToggle);
			drawerToggle.SyncState();

			//load default home screen
			var ft= FragmentManager.BeginTransaction ();
			ft.AddToBackStack (null);
			ft.Add (Resource.Id.HomeFrameLayout, new HomeFragment ());
			ft.Commit ();  
		}
开发者ID:suchithm,项目名称:NavigationDrawerMD,代码行数:29,代码来源:MainActivity.cs

示例12: MainDrawerToggle

		public MainDrawerToggle (ActionBarActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource) 
			: base(host, drawerLayout, openedResource, closedResource)
		{
			_hostActivity = host;
			_openedResource = openedResource;
			_closedResource = closedResource;
		}
开发者ID:dtimyr,项目名称:xamarin,代码行数:7,代码来源:MainDrawerToogle.cs

示例13: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.DrawerLayout);

            mActionBar = createActionBarHelper ();
            mActionBar.init ();

            items = new string[] { "Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers" };

            mDrawerList =FindViewById<ListView> (Resource.Id.left_drawer);
            mTextView =FindViewById <TextView> (Resource.Id.content_text_DrawerLayout);

            mDrawerList.Adapter = new ArrayAdapter<string>(this,Android.Resource.Layout.SimpleListItem1, items);
            mDrawerList.ItemClick += OnDrawerLIstItemClick;

            mDrawerLayout = (DrawerLayout)FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            mDrawerLayout.DrawerOpened += HandleDrawerOpened;
            mDrawerLayout.DrawerClosed += HandleDrawerClosed;

            // ActionBarDrawerToggle provides convenient helpers for tying together the
            // prescribed interactions between a top-level sliding drawer and the action bar.
            mDrawerToggle = new ActionBarDrawerToggle (this,
                                                       mDrawerLayout,
                                                       Resource.Drawable.ic_drawer,
                                                       Resource.String.drawer_open,
                                                       Resource.String.drawer_close);
        }
开发者ID:bopang,项目名称:monodroid-samples,代码行数:29,代码来源:DrawerLayoutActivity.cs

示例14: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here

			SetContentView (Resource.Layout.show_details);

			toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
			//Toolbar will now take on default actionbar characteristics
			SetSupportActionBar (toolbar);
			SupportActionBar.Title = "Show Details";
			SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_menu);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);


			drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);

			var navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);
			if (navigationView != null) {
				setupDrawerContent (navigationView);
			}
		
			myTextView = FindViewById<TextView> (Resource.Id.tvForID);
			//myTextView.Text = Intent.GetStringExtra ("TVDBID");

			var myDownloadTask = downloadURL ();

		}
开发者ID:robobat,项目名称:Trakker,代码行数:29,代码来源:ShowDetailsActivity.cs

示例15: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            mLeftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);

            mLeftDrawer.Tag = 0;

            SetSupportActionBar(mToolbar);

            mLeftDataSet = new List<string>();
            mLeftDataSet.Add ("Stores");
            mLeftDataSet.Add ("Groceries");
            mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter = mLeftAdapter;
            mLeftDrawer.ItemClick += DrawerListOnItemCLick;
            mDrawerToggle = new MyActionBarDrawerToggle(
                this,							//Host Activity
                mDrawerLayout,					//DrawerLayout
                Resource.String.openDrawer,		//Opened Message
                Resource.String.closeDrawer		//Closed Message
            );

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            mDrawerToggle.SyncState();
        }
开发者ID:prabjotsingh50,项目名称:hackathon_2,代码行数:33,代码来源:MainActivity.cs


注:本文中的DrawerLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。