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


C# DrawerLayout.CloseDrawer方法代码示例

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


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

示例1: 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

示例2: OnCreate

		#pragma warning restore 414

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.HomeView);

			mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer);
			mDrawerView = FindViewById (Resource.Id.items);
			mDrawerToggle = new ActionBarDrawerToggle (this, mDrawerLayout, Resource.Drawable.ic_navigation_drawer, 0, 0);
			mDrawerLayout.SetDrawerListener (mDrawerToggle);

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

			_closeDrawerToken = Mvx.Resolve<IMvxMessenger> ().SubscribeOnMainThread<CloseDrawerMessage> (
				message => mDrawerLayout.CloseDrawer (mDrawerView));     
		}
开发者ID:fatelord,项目名称:chgk,代码行数:18,代码来源:HomeView.cs

示例3: 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.myDrawer);
			notebooks = FindViewById<ListView>(Resource.Id.notebooks);
			leftSideMenu = FindViewById<LinearLayout>(Resource.Id.leftSideMenu);
			addNoteButton = FindViewById<Button>(Resource.Id.addButton);
			notes = FindViewById<ListView>(Resource.Id.notes);
			menuButton = FindViewById<Button>(Resource.Id.menuButton);
			syncButton = FindViewById<Button>(Resource.Id.syncButton);
			addNotebookButton = FindViewById<Button>(Resource.Id.addNotebookButton);

			drawerToggle = new SideMenuDrawerToggle(this, drawerLayout, Resource.String.open_drawer, Resource.String.close_drawer);//Resource.Drawable.Icon, -- removed
			drawerLayout.AddDrawerListener(drawerToggle);
			drawerLayout.CloseDrawer(leftSideMenu);

			notebooksAdapter = new NotebooksAdapter(this);
			notebooks.Adapter = notebooksAdapter;
			chosenNotebookId = Guid.Parse(notebooksAdapter.GetItemAtPosition(0).Id);

			notesAdapter = new NotesAdapter(this, chosenNotebookId);
			notes.Adapter = notesAdapter;

			addNoteButton.Click += AddNoteButton_Click;

			menuButton.Click += MenuButton_Click;

			syncButton.Click += SyncButton_Click;

			addNotebookButton.Click += AddNotebookButton_Click;

			notebooks.ItemClick += Notebooks_ItemClick; ;

			notes.ItemClick += Notes_ItemClick;
		}
开发者ID:Ferencz8,项目名称:RepeatApp,代码行数:39,代码来源:MainActivity.cs

示例4: setupToolbar

        public void setupToolbar(Toolbar _supporttoolbar, DrawerLayout _drawer, NavigationView _navigationview, int titleID, AppCompatActivity context)
        {
            ViewContext = context;
            _supporttoolbar.SetTitle(titleID);
            context.SetSupportActionBar(_supporttoolbar);
            _supporttoolbar.SetNavigationIcon(Resource.Drawable.ic_menu_white_24dp);

            context.SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            ErrorHandler error = new ErrorHandler(context);
            _navigationview.NavigationItemSelected += (sender, e) =>
            
            {
                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_recentEvents:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            var intent = new Intent(context, typeof(RecentEventsActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_createEvent:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            var intent = new Intent(context, typeof(EventCreationActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_deleteEvent:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to calendar view
                            var intent = new Intent(context, typeof(EventDeletionActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_calendar:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to calendar view
                            var intent = new Intent(context, typeof(CalendarViewActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_createEmployee:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to createEmployee view
                            var intent = new Intent(context, typeof(CreateEmployeeActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_overtime:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to overtime view
                            var intent = new Intent(context, typeof(OvertimeActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_filter:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            spawnFilterDialog();
                        }
                        break;
                    case Resource.Id.logoutitem:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            OnLogoutClicked();
                            var intent = new Intent(context, typeof(LoginActivity));
                            context.StartActivity(intent);
                        }
                        break;

                }
            };
        }
开发者ID:ititwcip,项目名称:ITWCIPApplication,代码行数:78,代码来源:ToolbarCreator.cs

示例5: OnCreate

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

            LogManager.LogFactory = new GenericLogFactory(Console.WriteLine);

			// Set our view from the "main" layout resource
			SetContentView(Resource.Layout.Main);
			// Get our button from the layout resource,
			// and attach an event to it
			Button sendButton = FindViewById<Button>(Resource.Id.sendMessageButton);
			messageBox = FindViewById<EditText>(Resource.Id.message);
			SupportToolbar mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
			mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
			navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
			mRightDrawer = FindViewById<ListView>(Resource.Id.right_drawer);
			var messageHistoryList = FindViewById<ListView>(Resource.Id.messageHistory);
            var chatBackground = FindViewById<ImageView>(Resource.Id.chat_background);
            InitDefaultBackground(chatBackground);

            navigationView.Tag = 0;
			mRightDrawer.Tag = 1;

			var messageHistoryAdapter = new MessageListViewAdapter(this, new List<ChatMessage>(), () => this.subscriberList);
			messageHistoryList.Adapter = messageHistoryAdapter;

		    var txtUser = FindViewById<TextView>(Resource.Id.txtUserName);
		    var imgProfile = FindViewById<ImageView>(Resource.Id.imgProfile);
		    var channels = new[] {"home"};
			cmdReceiver = new ChatCommandHandler (this, messageHistoryAdapter, "home");

		    client = new ServerEventsClient(BaseUrl, channels)
		    {
		        OnConnect = connectMsg =>
		        {
		            client.UpdateChatHistory(cmdReceiver).ConfigureAwait(false);
		            connectMsg.UpdateUserProfile(txtUser, imgProfile);
		        },
                OnCommand = command =>
                {
                    if (command is ServerEventJoin)
                    {
						client.GetSubscribers().ContinueWith(result => {
							result.Wait();
                            subscriberList = result.Result;
                            Application.SynchronizationContext.Post(_ =>
                            {
                                // Refresh profile icons when users join
                                messageHistoryAdapter.NotifyDataSetChanged();
                            }, null);
						});
                    }  
                },
		        OnException =
		            error =>
		            {
		                Application.SynchronizationContext.Post(
		                    _ => { Toast.MakeText(this, "Error : " + error.Message, ToastLength.Long); }, null);
		            },
		        //ServiceClient = new JsonHttpClient(BaseUrl),
		        Resolver = new MessageResolver(cmdReceiver)
		    };
		    client.RegisterNamedReceiver<ChatReceiver>("cmd");
            client.RegisterNamedReceiver<TvReciever>("tv");
            client.RegisterNamedReceiver<CssReceiver>("css");
            
            SetSupportActionBar(mToolbar);

		    var mRightDataSet = new List<string>(commands.Keys);
		    var mRightAdapter = new ActionListViewAdapter(this, mRightDataSet);
			mRightDrawer.Adapter = mRightAdapter;
		    mRightDrawer.ItemClick += (sender, args) =>
		    {
               Application.SynchronizationContext.Post(_ =>
               {
                   messageBox.Text = commands[mRightDataSet[args.Position]];
                   mDrawerLayout.CloseDrawer(mRightDrawer);
               },null);
		    };

			mDrawerToggle = new ChatActionBarDrawerToggle(
				this,							//Host Activity
				mDrawerLayout,					//DrawerLayout
				mToolbar,						// Instance of toolbar, if you use other ctor, the hamburger icon/arrow animation won't work..
				Resource.String.openDrawer,		//Opened Message
				Resource.String.closeDrawer		//Closed Message
			);

			SupportActionBar.SetHomeButtonEnabled(true);
			SupportActionBar.SetDisplayShowTitleEnabled(true);

			mDrawerLayout.SetDrawerListener(mDrawerToggle);
			mDrawerToggle.SyncState();

		    navigationView.NavigationItemSelected += OnChannelClick;
            sendButton.Click += OnSendClick;
		}
开发者ID:ServiceStackApps,项目名称:AndroidXamarinChat,代码行数:97,代码来源:MainActivity.cs

示例6: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            SetTheme (Resource.Style.Theme_Sherlock);
            base.OnCreate (bundle);
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            list = FindViewById<ListView> (Resource.Id.list);
            drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
            adapter = new CustomAdapter (this, list_text);
            list.Adapter = adapter;
            fragA = new FragmentA ();
            fragB = new FragmentB ();
            list.ItemClick += (sender, e) => {
                ListView item = sender as ListView;
                int pos = item.CheckedItemPosition;
                TextView t = (TextView) e.View.FindViewById(Resource.Id.textView1);
                string mess = t.Text;
                Bundle args = new Bundle();
                args.PutString("message", mess);
                transaction = SupportFragmentManager.BeginTransaction();
                switch (pos){
                case 0:
                    if(!fragA.IsVisible){
                        fragA.Arguments = args;
                        transaction.Replace(Resource.Id.frame, fragA);
                    }
                    break;
                case 1:
                    if(!fragB.IsVisible){
                        fragB.Arguments = args;
                        transaction.Replace(Resource.Id.frame, fragB);
                    }
                    break;

                }
                transaction.Commit();
                list.SetItemChecked(pos, true);
                drawer.CloseDrawer(list);

            };

            mDrawerToggle = new Android.Support.V4.App.ActionBarDrawerToggle(this, drawer,  Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close)
            {
            };
            drawer.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetHomeButtonEnabled(true);
            // Get our button from the layout resource,
            // and attach an event to it
        }
开发者ID:sergeyfitis,项目名称:XamarinTest,代码行数:50,代码来源:MainActivity.cs


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