本文整理了Java中android.view.SubMenu.size()
方法的一些代码示例,展示了SubMenu.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SubMenu.size()
方法的具体详情如下:
包路径:android.view.SubMenu
类名称:SubMenu
方法名:size
暂无
代码示例来源:origin: stackoverflow.com
navView = (NavigationView) findViewById(R.id.navView);
Menu m = navView.getMenu();
for (int i=0;i<m.size();i++) {
MenuItem mi = m.getItem(i);
//for aapplying a font to subMenu ...
SubMenu subMenu = mi.getSubMenu();
if (subMenu!=null && subMenu.size() >0 ) {
for (int j=0; j <subMenu.size();j++) {
MenuItem subMenuItem = subMenu.getItem(j);
applyFontToMenuItem(subMenuItem);
}
}
//the method we have create in activity
applyFontToMenuItem(mi);
}
代码示例来源:origin: ankidroid/Anki-Android
@Override
public void onPrepareSubMenu(SubMenu subMenu) {
subMenu.clear();
getMenuInflater().inflate(R.menu.reviewer_schedule, subMenu);
for (int i = 0; i < subMenu.size(); i++) {
subMenu.getItem(i).setOnMenuItemClickListener(this);
}
}
代码示例来源:origin: ankidroid/Anki-Android
@Override
public void onPrepareSubMenu(SubMenu subMenu) {
subMenu.clear();
getMenuInflater().inflate(R.menu.reviewer_suspend, subMenu);
for (int i = 0; i < subMenu.size(); i++) {
subMenu.getItem(i).setOnMenuItemClickListener(this);
}
}
代码示例来源:origin: ankidroid/Anki-Android
@Override
public void onPrepareSubMenu(SubMenu subMenu) {
subMenu.clear();
getMenuInflater().inflate(R.menu.reviewer_bury, subMenu);
for (int i = 0; i < subMenu.size(); i++) {
subMenu.getItem(i).setOnMenuItemClickListener(this);
}
}
代码示例来源:origin: Flipboard/bottomsheet
for (int subI = 0, size = subMenu.size(); subI < size; subI++) {
MenuItem subMenuItem = subMenu.getItem(subI);
if (subMenuItem.isVisible()) {
代码示例来源:origin: stackoverflow.com
SubMenu sm = menuItem.getSubMenu();
String title = "";
for (int i = 0; i < sm.size(); i++) {
MenuItem mi = sm.getItem(i);
title = mi.getTitle().toString();
if (title.length() > 10) {
String truncated = title.subSequence(0, title.length() - 3).toString().concat("...");
mi.setTitle(truncated);
}
}
代码示例来源:origin: stackoverflow.com
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
SubMenu subMenu = menu.getItem(0).getSubMenu();
for (int i = 0; i < subMenu.size(); i++) {
MenuItem menuItem = subMenu.getItem(i);
CharSequence menuTitle = menuItem.getTitle();
SpannableString styledMenuTitle = new SpannableString(menuTitle);
styledMenuTitle.setSpan(new ForegroundColorSpan(Color.BLACK), 0, menuTitle.length(), 0);
menuItem.setTitle(styledMenuTitle);
}
}
代码示例来源:origin: stackoverflow.com
navView = (NavigationView) findViewById(R.id.navView);
Menu m = navView.getMenu();
for (int i=0;i<m.size();i++) {
MenuItem mi = m.getItem(i);
//for aapplying a font to subMenu ...
SubMenu subMenu = mi.getSubMenu();
if (subMenu!=null && subMenu.size() >0 ) {
for (int j=0; j <subMenu.size();j++) {
MenuItem subMenuItem = subMenu.getItem(j);
applyFontToMenuItem(subMenuItem);
}
}
//the method we have create in activity
applyFontToMenuItem(mi);
}
代码示例来源:origin: konradrenner/kolabnotes-android
public void deleteNotebook(String notebookName){
final SubMenu notebookSubmenu = view.getMenu().findItem(R.id.navigation_notebooks).getSubMenu();
for(int i=0; i<notebookSubmenu.size(); i++){
final int currentId = notebookSubmenu.getItem(i).getItemId();
final String actualTitle = notebookSubmenu.getItem(i).getTitle().toString();
if(actualTitle.equals(notebookName)){
notebookSubmenu.removeItem(currentId);
}
}
}
代码示例来源:origin: derry/delion
@Override
public int getItemViewType(int position) {
MenuItem item = getItem(position);
int viewCount = item.hasSubMenu() ? item.getSubMenu().size() : 1;
if (item.getItemId() == R.id.update_menu_id) {
return UPDATE_MENU_ITEM;
} else if (viewCount == 4) {
return FOUR_BUTTON_MENU_ITEM;
} else if (viewCount == 3) {
return THREE_BUTTON_MENU_ITEM;
} else if (viewCount == 2) {
return TITLE_BUTTON_MENU_ITEM;
}
return STANDARD_MENU_ITEM;
}
代码示例来源:origin: konradrenner/kolabnotes-android
private MenuItem addTag(SubMenu tagMenu, OnDrawerSelectionChangedListener listener, Tag tag){
SpannableString spannable = new SpannableString(tag.getName());
if(tag.getColor() != null) {
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(tag.getColor().getHexcode())), 0, spannable.length(), 0);
}
final MenuItem newTagEntry = tagMenu.add(Menu.NONE, tagMenu.size(), Menu.NONE, spannable);
newTagEntry.setOnMenuItemClickListener(new OnTagItemClickedListener(listener, layout));
return newTagEntry;
}
代码示例来源:origin: stackoverflow.com
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
Menu m = navigationView .getMenu();
for (int i=0;i<m.size();i++) {
MenuItem mi = m.getItem(i);
//for applying a font to subMenu ...
SubMenu subMenu = mi.getSubMenu();
if (subMenu!=null && subMenu.size() >0 ) {
for (int j=0; j <subMenu.size();j++) {
MenuItem subMenuItem = subMenu.getItem(j);
SpannableString s = new SpannableString(subMenuItem.getTitle());
s.setSpan(new TypefaceSpan("fonts/yourfontname.ttf"), 0, s.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
subMenuItem.setTitle(s);
}
}
}
代码示例来源:origin: marzika/Snapprefs
private void selectNavItemFromSub(String entryName, SubMenu subMenu) {
for(int i = 0; i < subMenu.size(); i++) {
MenuItem item = subMenu.getItem(i);
if( item.hasSubMenu() )
selectNavItemFromSub(entryName, item.getSubMenu());
else {
if (item.getTitle().equals(entryName)) {
selectNavItem(item);
return;
}
}
}
}
代码示例来源:origin: konradrenner/kolabnotes-android
private MenuItem addNotebook(Context context, SubMenu notebookMenu, OnDrawerSelectionChangedListener listener, Notebook notebook){
final MenuItem newNotebookEntry = notebookMenu.add(Menu.NONE, notebookMenu.size(), Menu.NONE, notebook.getSummary());
setNotebookPermissionIcon(context, notebook, newNotebookEntry);
newNotebookEntry.setOnMenuItemClickListener(new OnNotebookItemClickedListener(listener, layout));
return newNotebookEntry;
}
代码示例来源:origin: mkulesh/microMathematics
if (m.getItemId() == R.id.nav_group_examples)
for (int j = 0; j < Math.min(m.getSubMenu().size(), activitySubtitles.length); j++)
for (int j = 0; j < Math.min(m.getSubMenu().size(), activityTitles.length); j++)
代码示例来源:origin: jahirfiquitiva/IconShowcase
for (int j = 0; j < subMenu.size(); j++) {
colorMenuItem(subMenu.getItem(j), iconsColor, iconsAlpha);
代码示例来源:origin: jahirfiquitiva/IconShowcase
public static void tintMenu(final Menu menu, @ColorInt final int iconsColor) {
if (menu != null) {
for (int i = 0, size = menu.size(); i < size; i++) {
MenuItem menuItem = menu.getItem(i);
if (isInOverflow(menuItem)) {
colorMenuItem(menuItem, iconsColor);
}
if (menuItem.hasSubMenu()) {
SubMenu subMenu = menuItem.getSubMenu();
for (int j = 0; j < subMenu.size(); j++) {
colorMenuItem(subMenu.getItem(j), iconsColor);
}
}
}
}
}
代码示例来源:origin: jahirfiquitiva/IconShowcase
@Override
public void run() {
if (menu != null) {
for (int i = 0, size = menu.size(); i < size; i++) {
MenuItem menuItem = menu.getItem(i);
if (isInOverflow(menuItem)) {
colorMenuItem(menuItem, iconsColor, iconsAlpha);
} else {
colorMenuItem(menu.getItem(i), iconsColor, iconsAlpha);
}
if (menuItem.hasSubMenu()) {
SubMenu subMenu = menuItem.getSubMenu();
for (int j = 0; j < subMenu.size(); j++) {
colorMenuItem(subMenu.getItem(j), iconsColor, iconsAlpha);
}
}
}
}
if (iconsColor != null) {
colorOverflowMenuItem(overflowButton);
}
}
代码示例来源:origin: jruesga/rview
MenuItem group = menu.getItem(myFiltersGroupIndex);
SubMenu myFiltersSubMenu = group.getSubMenu();
int count = myFiltersSubMenu.size() - 1;
for (int i = count; i >= 0; i--) {
((DrawerNavigationSubMenu)myFiltersSubMenu).removeItemAt(i);
代码示例来源:origin: jruesga/rview
MenuItem group = menu.getItem(otherAccountGroupIndex);
SubMenu otherAccountsSubMenu = group.getSubMenu();
int count = otherAccountsSubMenu.size() - 1;
for (int i = count; i > 0; i--) {
((DrawerNavigationSubMenu) otherAccountsSubMenu).removeItemAt(i);
内容来源于网络,如有侵权,请联系作者删除!