本文整理汇总了Java中com.actionbarsherlock.view.MenuItem.getIcon方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.getIcon方法的具体用法?Java MenuItem.getIcon怎么用?Java MenuItem.getIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.actionbarsherlock.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.getIcon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSubMenuSelected
import com.actionbarsherlock.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
if (subMenu.hasVisibleItems()) {
MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
subPopup.setCallback(mPresenterCallback);
boolean preserveIconSpacing = false;
final int count = subMenu.size();
for (int i = 0; i < count; i++) {
MenuItem childItem = subMenu.getItem(i);
if (childItem.isVisible() && childItem.getIcon() != null) {
preserveIconSpacing = true;
break;
}
}
subPopup.setForceShowIcon(preserveIconSpacing);
if (subPopup.tryShow()) {
if (mPresenterCallback != null) {
mPresenterCallback.onOpenSubMenu(subMenu);
}
return true;
}
}
return false;
}
示例2: ActionButtonSubmenu
import com.actionbarsherlock.view.MenuItem; //导入方法依赖的package包/类
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
super(context, subMenu);
//UNUSED mSubMenu = subMenu;
MenuItemImpl item = (MenuItemImpl) subMenu.getItem();
if (!item.isActionButton()) {
// Give a reasonable anchor to nested submenus.
setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
}
setCallback(mPopupPresenterCallback);
boolean preserveIconSpacing = false;
final int count = subMenu.size();
for (int i = 0; i < count; i++) {
MenuItem childItem = subMenu.getItem(i);
if (childItem.isVisible() && childItem.getIcon() != null) {
preserveIconSpacing = true;
break;
}
}
setForceShowIcon(preserveIconSpacing);
}