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


C# Android.FindItem方法代码示例

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


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

示例1: OnPrepareOptionsMenu

		public override bool OnPrepareOptionsMenu (Android.Views.IMenu menu)
		{
			if (mSortMode != -1) {
				var icon = menu.FindItem (mSortMode).Icon;
				menu.FindItem(Resource.Id.action_sort).SetIcon (icon);
			}
			return base.OnPrepareOptionsMenu(menu);
		}
开发者ID:SNest,项目名称:KitchenHelper,代码行数:8,代码来源:ActionBarUsage.cs

示例2: OnCreateOptionsMenu

		//add custom icon to tolbar
		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			MenuInflater.Inflate (Resource.Menu.action_menu,menu);
			if (menu != null) { 
				menu.FindItem (Resource.Id.action_refresh).SetVisible (true); 
				menu.FindItem (Resource.Id.action_attach).SetVisible (false);
			}
			return base.OnCreateOptionsMenu (menu);
		}
开发者ID:suchithm,项目名称:NavigationDrawerMD,代码行数:10,代码来源:MainActivity.cs

示例3: OnPrepareOptionsMenu

		public override bool OnPrepareOptionsMenu (Android.Views.IMenu menu)
		{
			menu.Clear();

			var items = _viewModel.OptionsMenu;

			foreach(var item in items)
			{
				menu
					.Add(0,
					item.Id,
					0,
					new Java.Lang.String(item.Text));

				var menuItem = menu.FindItem(item.Id);

				switch(item.ShowAs)
				{
				case ShowAs.Hidden:
					{
						menuItem.SetShowAsAction(Android.Views.ShowAsAction.Never);
					}
					break;
				case ShowAs.Visible:
					{
						menuItem.SetShowAsAction(Android.Views.ShowAsAction.IfRoom);
					}
					break;
				default: 
					break;
				}
			}

			return base.OnPrepareOptionsMenu(menu);
		}
开发者ID:Willjobs94,项目名称:empleo-dot-net,代码行数:35,代码来源:MainPageActivity.cs

示例4: OnCreateOptionsMenu

 public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
 {
     MenuInflater.Inflate(Resource.Menu.menu_events, menu);
     var item = menu.FindItem(Resource.Id.menu_filter_events);
     item.SetTitle(Settings.ShowAllEvents ? Resource.String.limit_events : Resource.String.show_all_events);
     return base.OnCreateOptionsMenu(menu);
 }
开发者ID:Cheesebaron,项目名称:MeetupManager,代码行数:7,代码来源:EventsView.cs

示例5: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			MenuInflater.Inflate (Resource.Menu.main_screen, menu);

			_addAlarmMenuButton = menu.FindItem (Resource.Id.add_alarm);
			_acceptMenuButton = menu.FindItem (Resource.Id.accept);
			_alarmNameMenuItem = menu.FindItem (Resource.Id.alarm_name);
			_deleteAlarmMenuItem = menu.FindItem (Resource.Id.delete);
			_disableAlarmMenuItem = menu.FindItem (Resource.Id.switch_button);
			_alarmRadiusMenuItem = menu.FindItem (Resource.Id.alarm_radius);
			_settingsMenuItem = menu.FindItem (Resource.Id.action_settings);
            
			_alarmNameEditText = MenuItemCompat.GetActionView (_alarmNameMenuItem) as EditText;
			_alarmNameEditText.Hint = Resources.GetString (Resource.String.alarm_name);
			_alarmNameEditText.SetWidth (Resources.GetDimensionPixelSize (Resource.Dimension.abc_search_view_preferred_width));

			_enableAlarmToggleButton = MenuItemCompat.GetActionView (_disableAlarmMenuItem) as ToggleButton;
			_enableAlarmToggleButton.CheckedChange += AlarmEnabledChange;

			_alarmRadiusSpinner = MenuItemCompat.GetActionView (_alarmRadiusMenuItem) as Spinner;
			var adapter = new ArrayAdapter (this, Resource.Layout.support_simple_spinner_dropdown_item, 
				              Android.Resource.Id.Text1, Constants.AlarmRadiusValues.Select (r => string.Format ("{0} m", r)).ToList ());
			adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			_alarmRadiusSpinner.Adapter = adapter;
			_alarmRadiusSpinner.ItemSelected += (s, e) => RedrawAddCircle ();

			ManageMenuItemsVisibilityForMode ();

			_addAlarmMenuButton.SetVisible (_isGooglePlayServicesAvailable == ConnectionResult.Success);

			return base.OnCreateOptionsMenu (menu);
		}
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:32,代码来源:HomeActivityAddMode.cs

示例6: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			var inflater = MenuInflater;
			inflater.Inflate(Resource.Menu.actions, menu);
			var arg1 = menu.FindItem (Resource.Id.action_search);

			var test = new Android.Support.V7.Widget.SearchView (this);
			arg1.SetActionView (test);

			var searchView = MenuItemCompat.GetActionView (arg1);
			var searchView2 = searchView as Android.Support.V7.Widget.SearchView;
			searchView2.QueryTextChange += (sender, e) => {
				e.Handled = OnQueryTextChange (e.NewText);
			};

			searchView2.QueryTextSubmit += (sender, e) => {
				e.Handled = OnQueryTextSubmit (e.Query);
			};

			return true;
		}
开发者ID:SNest,项目名称:KitchenHelper,代码行数:21,代码来源:ActionBarUsage.cs

示例7: OnPrepareActionMode

		public bool OnPrepareActionMode (ActionMode mode, Android.Views.IMenu menu)
		{
			Logger.Debug ("onPrepareActionMode");

			bool selectionContainsRead = false;
			bool selectionContainsUnread = false;

			foreach (string id in inbox.SelectedMessages) {
				RichPushMessage message = richPushInbox.GetMessage (id);
				if (message.IsRead) {
					selectionContainsRead = true;
				} else {
					selectionContainsUnread = true;
				}

				if (selectionContainsRead && selectionContainsUnread) {
					break;
				}
			}

			// Show them both
			menu.FindItem (Resource.Id.mark_read).SetVisible (selectionContainsUnread);
			menu.FindItem (Resource.Id.mark_unread).SetVisible (selectionContainsRead);

			// If we have an action selection button update the text
			if (actionSelectionButton != null) {
				string selectionText = this.GetString (Resource.String.cab_selection, inbox.SelectedMessages.Count);
				actionSelectionButton.Text = selectionText;
			}

			return true;
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:32,代码来源:InboxActivity.cs

示例8: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.alarm_screen, menu);

            _deleteAlarmMenuItem = menu.FindItem(Resource.Id.delete);
            _disableAlarmMenuItem = menu.FindItem(Resource.Id.switch_button);

            _enableAlarmToggleButton = MenuItemCompat.GetActionView(_disableAlarmMenuItem) as ToggleButton;
            _enableAlarmToggleButton.SetBackgroundResource(Resource.Drawable.toggle_button);
            _enableAlarmToggleButton.Checked = _selectedAlarm.Enabled;
            _enableAlarmToggleButton.CheckedChange += AlarmEnabledChange;

            CorrectOptionsMenuVisibility();

            return base.OnCreateOptionsMenu(menu);
        }
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:16,代码来源:AlarmScreen.cs


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