本文整理了Java中android.view.SubMenu.findItem()
方法的一些代码示例,展示了SubMenu.findItem()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SubMenu.findItem()
方法的具体详情如下:
包路径:android.view.SubMenu
类名称:SubMenu
方法名:findItem
暂无
代码示例来源:origin: pockethub/PocketHub
private void setUpNavigationMenu() {
MenuItem organizationContainer = navigationView.getMenu().findItem(R.id.navigation_organizations);
if (organizationContainer.hasSubMenu()) {
SubMenu organizationsMenu = organizationContainer.getSubMenu();
for (int i = 1; i < orgs.size(); i++) {
User organization = orgs.get(i);
if (organizationsMenu.findItem(organization.id().intValue()) == null) {
MenuItem organizationMenuItem = organizationsMenu.add(Menu.NONE, organization.id().intValue(), Menu.NONE, organization.name() != null ? organization.name() : organization.login());
organizationMenuItem.setIcon(R.drawable.ic_github_organization_black_24dp);
//Because of tinting the real image would became a grey block
//avatars.bind(organizationMenuItem, organization);
menuItemOrganizationMap.put(organizationMenuItem, organization);
}
}
} else {
throw new IllegalStateException("Menu item " + organizationContainer + " should have a submenu");
}
}
代码示例来源:origin: ZieIony/Carbon
@Override
public android.view.MenuItem findItem(int id) {
final int size = size();
for (int i = 0; i < size; i++) {
MenuItem item = mItems.get(i);
if (item.getItemId() == id) {
return item;
} else if (item.hasSubMenu()) {
android.view.MenuItem possibleItem = item.getSubMenu().findItem(id);
if (possibleItem != null) {
return possibleItem;
}
}
}
return null;
}
代码示例来源:origin: adafruit/Bluefruit_LE_Connect_Android
SubMenu displayModeSubMenu = displayModeMenuItem.getSubMenu();
if (mIsTimestampDisplayMode) {
MenuItem displayModeTimestampMenuItem = displayModeSubMenu.findItem(R.id.action_displaymode_timestamp);
displayModeTimestampMenuItem.setChecked(true);
} else {
MenuItem displayModeTextMenuItem = displayModeSubMenu.findItem(R.id.action_displaymode_text);
displayModeTextMenuItem.setChecked(true);
SubMenu dataModeSubMenu = dataModeMenuItem.getSubMenu();
if (mShowDataInHexFormat) {
MenuItem dataModeHexMenuItem = dataModeSubMenu.findItem(R.id.action_datamode_hex);
dataModeHexMenuItem.setChecked(true);
} else {
MenuItem dataModeAsciiMenuItem = dataModeSubMenu.findItem(R.id.action_datamode_ascii);
dataModeAsciiMenuItem.setChecked(true);
break;
MenuItem selectedEolCharacterMenuItem = eolModeSubMenu.findItem(selectedEolCharactersSubMenuId);
selectedEolCharacterMenuItem.setChecked(true);
内容来源于网络,如有侵权,请联系作者删除!