本文整理汇总了C#中IMenuItem.getItemId方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem.getItemId方法的具体用法?C# IMenuItem.getItemId怎么用?C# IMenuItem.getItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.getItemId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onOptionsItemSelected
public override bool onOptionsItemSelected(IMenuItem item)
{
switch (item.getItemId()) {
case android.Resource.Id.home:
// app icon in action bar clicked; go home
Intent intent = new Intent(this, typeof(Tomdroid));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
StartActivity(intent);
return true;
case Resource.Id.menuPrefs:
StartActivity(new Intent(this, typeof(PreferencesActivity)));
return true;
case Resource.Id.edit_note_save:
saveNote();
return true;
case Resource.Id.edit_note_discard:
discardNoteContent();
return true;
/* case Resource.Id.edit_note_xml:
if(!xmlOn) {
item.setTitle(GetString(Resource.String.text));
item.setIcon(Resource.Drawable.text);
xmlOn = true;
StringBuilder newNoteContent = (StringBuilder) content.getText();
// store changed note content
string newXmlContent = new NoteXMLContentBuilder().setCaller(noteXMLWriteHandler).setInputSource(newNoteContent).build();
// Since 0.5 EditNote expects the redundant title being removed from the note content, but we still may need this for debugging:
//note.setXmlContent("<note-content version=\"0.1\">"+note.getTitle()+"\n\n"+newXmlContent+"</note-content>");
TLog.d(TAG, "new xml content: {0}", newXmlContent);
note.setXmlContent(newXmlContent);
formatBarShell.setVisibility(View.GONE);
content.SetText(note.getXmlContent());
}
else {
item.setTitle(GetString(Resource.String.xml));
item.setIcon(Resource.Drawable.xml);
xmlOn = false;
updateNoteContent(true); // update based on xml that we are switching FROM
if(content.isFocused())
formatBarShell.setVisibility(View.VISIBLE);
}
return true;*/
}
return base.onOptionsItemSelected(item);
}