android.view.MenuItem.setTitleCondensed()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中android.view.MenuItem.setTitleCondensed()方法的一些代码示例,展示了MenuItem.setTitleCondensed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.setTitleCondensed()方法的具体详情如下:
包路径:android.view.MenuItem
类名称:MenuItem
方法名:setTitleCondensed

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

item = item.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
assertThat(item).isNotNull();
item = item.setTitleCondensed("condensed");
assertThat(item).isNotNull();
item = item.setVisible(true);

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public MenuItem setTitleCondensed(CharSequence title) {
  mNativeItem.setTitleCondensed(title);
  return this;
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public MenuItem setTitleCondensed(CharSequence title) {
  mNativeItem.setTitleCondensed(title);
  return this;
}

代码示例来源:origin: derry/delion

/**
   * Updates the bookmark item's visibility.
   *
   * @param bookmarkMenuItem {@link MenuItem} for adding/editing the bookmark.
   * @param currentTab        Current tab being displayed.
   */
  protected void updateBookmarkMenuItem(MenuItem bookmarkMenuItem, Tab currentTab) {
    bookmarkMenuItem.setEnabled(mBookmarkBridge.isEditBookmarksEnabled());
    if (currentTab.getBookmarkId() != Tab.INVALID_BOOKMARK_ID) {
      bookmarkMenuItem.setIcon(R.drawable.btn_star_filled);
      bookmarkMenuItem.setChecked(true);
      bookmarkMenuItem.setTitleCondensed(mActivity.getString(R.string.edit_bookmark));
    } else {
      bookmarkMenuItem.setIcon(R.drawable.btn_star);
      bookmarkMenuItem.setChecked(false);
      bookmarkMenuItem.setTitleCondensed(null);
    }
  }
}

代码示例来源:origin: stackoverflow.com

@Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
  if (item.getTitle() instanceof SpannableString) {
    SpannableString sp = (SpannableString)item.getTitle();
    Object[] spans = sp.getSpans(0, sp.length(), Object.class);
    if (spans != null && spans.length > 0) {
      // set text without span markups, need for super.onMenuItemSelected(featureId, item);
      item.setTitleCondensed(sp.toString());
      boolean result = super.onMenuItemSelected(featureId, item);
      item.setTitleCondensed(sp);
      return result;
    }
  }

  return super.onMenuItemSelected(featureId, item);
}

代码示例来源:origin: hamidness/restring

bottomNavigationView.getMenu().findItem(entry.getKey()).setTitleCondensed(
    resources.getString(entry.getValue().titleCondensed)
);

代码示例来源:origin: ABTSoftware/SciChart.Android.Examples

@Override
  protected void onPostExecute(Void aVoid) {
    sortBySpinner.setAdapter(spinnerStringAdapter);
    for (int i = 0; i < categories.size(); ++i) {
      String category = categories.get(i);
      MenuItem menuItem = navMenu.add(Menu.NONE, View.generateViewId(), Menu.NONE, module.getCategoryName(category));
      menuItem.setTitleCondensed(category);
      menuItem.setIcon(module.getIconForCategory(category));
      menuItem.setCheckable(true);
      menuItem.setChecked(i == selectedPosition);
    }
    synchronized (HomeActivity.getModule().getExamples()) {
      openFragment(exampleId, savedInstanceState);
    }
    updateLoadExamples(selectedPosition);
    mainScreen.setVisibility(View.VISIBLE);
    hideProgressBar();
  }
}.execute();

代码示例来源:origin: kebernet/shortyz

reveal.add(createSpannableForMenu("Letter")).setTitleCondensed("Letter");
  reveal.add(createSpannableForMenu("Word")).setTitleCondensed("Word");
  reveal.add(createSpannableForMenu("Errors")).setTitleCondensed("Errors");
  reveal.add(createSpannableForMenu("Puzzle")).setTitleCondensed("Puzzle");
  if (ShortyzApplication.isTabletish(metrics)) {
    utils.onActionBarWithText(reveal);
clueSize.add(createSpannableForMenu("Small")).setTitleCondensed("Small");
clueSize.add(createSpannableForMenu("Medium")).setTitleCondensed("Medium");
clueSize.add(createSpannableForMenu("Large")).setTitleCondensed("Large");
Menu zoom = menu.addSubMenu("Zoom");
zoom.add(createSpannableForMenu("Zoom In")).setTitleCondensed("Zoom In");
  zoom.add(createSpannableForMenu("Zoom In Max")).setTitleCondensed("Zoom In Max");
zoom.add(createSpannableForMenu("Zoom Out")).setTitleCondensed("Zoom Out");
zoom.add(createSpannableForMenu("Fit to Screen")).setTitleCondensed("Fit to Screen");
zoom.add(createSpannableForMenu("Zoom Reset")).setTitleCondensed("Zoom Reset");
menu.add("Info").setIcon(android.R.drawable.ic_menu_info_details);
menu.add("Help").setIcon(android.R.drawable.ic_menu_help);

代码示例来源:origin: derry/delion

requestItem.setVisible(!isChromeScheme || currentTab.isNativePage());
requestItem.setChecked(currentTab.getUseDesktopUserAgent());
requestItem.setTitleCondensed(requestItem.isChecked()
    ? mActivity.getString(R.string.menu_request_desktop_site_on)
    : mActivity.getString(R.string.menu_request_desktop_site_off));

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

nativeSubItem.setNumericShortcut(subItem.getNumericShortcut());
    nativeSubItem.setAlphabeticShortcut(subItem.getAlphabeticShortcut());
    nativeSubItem.setTitleCondensed(subItem.getTitleCondensed());
    nativeSubItem.setCheckable(subItem.isCheckable());
    nativeSubItem.setChecked(subItem.isChecked());
nativeItem.setNumericShortcut(nonActionItem.getNumericShortcut());
nativeItem.setAlphabeticShortcut(nonActionItem.getAlphabeticShortcut());
nativeItem.setTitleCondensed(nonActionItem.getTitleCondensed());
nativeItem.setCheckable(nonActionItem.isCheckable());
nativeItem.setChecked(nonActionItem.isChecked());

代码示例来源:origin: com.willowtreeapps/oak-demos

nativeSubItem.setNumericShortcut(subItem.getNumericShortcut());
    nativeSubItem.setAlphabeticShortcut(subItem.getAlphabeticShortcut());
    nativeSubItem.setTitleCondensed(subItem.getTitleCondensed());
    nativeSubItem.setCheckable(subItem.isCheckable());
    nativeSubItem.setChecked(subItem.isChecked());
nativeItem.setNumericShortcut(nonActionItem.getNumericShortcut());
nativeItem.setAlphabeticShortcut(nonActionItem.getAlphabeticShortcut());
nativeItem.setTitleCondensed(nonActionItem.getTitleCondensed());
nativeItem.setCheckable(nonActionItem.isCheckable());
nativeItem.setChecked(nonActionItem.isChecked());

代码示例来源:origin: MCMrARM/revolution-irc

SpannableString s = new SpannableString(presets[i] + " " + presetsText[i]);
s.setSpan(new ForegroundColorSpan(secondaryColor), presets[i].length() + 1, s.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
menu.getMenu().add(s).setTitleCondensed(presets[i]);

相关文章