本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}