本文整理了Java中android.view.Menu.hasVisibleItems()
方法的一些代码示例,展示了Menu.hasVisibleItems()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.hasVisibleItems()
方法的具体详情如下:
包路径:android.view.Menu
类名称:Menu
方法名:hasVisibleItems
暂无
代码示例来源:origin: square/assertj-android
public MenuAssert hasVisibleItems() {
isNotNull();
Assertions.assertThat(actual.hasVisibleItems()) //
.overridingErrorMessage("Expected to have visible items but had no visible items.") //
.isTrue();
return this;
}
代码示例来源:origin: square/assertj-android
public MenuAssert hasNoVisibleItems() {
isNotNull();
Assertions.assertThat(actual.hasVisibleItems()) //
.overridingErrorMessage("Expected to have no visible items but had visible items.") //
.isFalse();
return this;
}
代码示例来源:origin: willowtreeapps/Hyperion-Android
public static Collection<ViewAttribute> createMenuAttributes(@NonNull Context context, @NonNull Menu menu) {
final Resources res = context.getResources();
List<ViewAttribute> attributes = new ArrayList<>();
attributes.add(new ViewAttribute<>("MenuSize", menu.size()));
attributes.add(new ViewAttribute<>("MenuHasVisibleItems", menu.hasVisibleItems()));
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
String prefix = "Item " + i + ": ";
attributes.add(new ViewAttribute<>(prefix + "Title", item.getTitle()));
attributes.add(new ViewAttribute<>(prefix + "ContentDescription",
MenuItemCompat.getContentDescription(item)));
attributes.add(new ViewAttribute<>(prefix + "TooltipText", MenuItemCompat.getTooltipText(item)));
attributes.add(new ViewAttribute<>(prefix + "Checkable", item.isCheckable()));
attributes.add(new ViewAttribute<>(prefix + "Checked", item.isChecked()));
attributes.add(new ViewAttribute<>(prefix + "Enabled", item.isEnabled()));
attributes.add(new ViewAttribute<>(prefix + "Visible", item.isVisible()));
attributes.add(new ViewAttribute<>(prefix + "Order", item.getOrder()));
attributes.add(new ViewAttribute<Void>(prefix + "Icon", item.getIcon()));
attributes.add(createColorAttribute("IconTint",
MenuItemCompat.getIconTintList(item)));
attributes.add(new ViewAttribute<>("IconTintMode",
new PorterDuffModeValue(MenuItemCompat.getIconTintMode(item))));
attributes.add(new ViewAttribute<>(prefix + "Id", new ResourceValue(res, item.getItemId())));
attributes.add(new ViewAttribute<>(prefix + "GroupId", new ResourceValue(res, item.getGroupId())));
}
return attributes;
}
代码示例来源:origin: com.actionbarsherlock/actionbarsherlock
@Override
public boolean hasVisibleItems() {
return mNativeMenu.hasVisibleItems();
}
代码示例来源:origin: com.willowtreeapps/oak-demos
@Override
public boolean hasVisibleItems() {
return mNativeMenu.hasVisibleItems();
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public MenuAssert hasVisibleItems() {
isNotNull();
Assertions.assertThat(actual.hasVisibleItems()) //
.overridingErrorMessage("Expected to have visible items but had no visible items.") //
.isTrue();
return this;
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public MenuAssert hasNoVisibleItems() {
isNotNull();
Assertions.assertThat(actual.hasVisibleItems()) //
.overridingErrorMessage("Expected to have no visible items but had visible items.") //
.isFalse();
return this;
}
代码示例来源:origin: com.google.android/support-v4
/**
* Dispatch onPrepareOptionsMenu() to fragments.
*/
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL && menu != null) {
if (mOptionsMenuInvalidated) {
mOptionsMenuInvalidated = false;
menu.clear();
onCreatePanelMenu(featureId, menu);
}
boolean goforit = super.onPreparePanel(featureId, view, menu);
goforit |= mFragments.dispatchPrepareOptionsMenu(menu);
return goforit && menu.hasVisibleItems();
}
return super.onPreparePanel(featureId, view, menu);
}
内容来源于网络,如有侵权,请联系作者删除!