android.support.v7.widget.Toolbar.getSubtitle()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(115)

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

Toolbar.getSubtitle介绍

暂无

代码示例

代码示例来源:origin: chrisjenx/Calligraphy

/**
 * An even dirtier way to see if the TextView is part of the ActionBar
 *
 * @param view TextView to check is Title
 * @return true if it is.
 */
@SuppressLint("NewApi")
protected static boolean isActionBarSubTitle(TextView view) {
  if (matchesResourceIdName(view, ACTION_BAR_SUBTITLE)) return true;
  if (parentIsToolbarV7(view)) {
    final android.support.v7.widget.Toolbar parent = (android.support.v7.widget.Toolbar) view.getParent();
    return TextUtils.equals(parent.getSubtitle(), view.getText());
  }
  return false;
}

代码示例来源:origin: chrisjenx/Calligraphy

/**
   * Will forcibly set text on the views then remove ones that didn't have copy.
   *
   * @param view toolbar view.
   */
  private void applyFontToToolbar(final Toolbar view) {
    final CharSequence previousTitle = view.getTitle();
    final CharSequence previousSubtitle = view.getSubtitle();
    // The toolbar inflates both the title and the subtitle views lazily but luckily they do it
    // synchronously when you set a title and a subtitle programmatically.
    // So we set a title and a subtitle to something, then get the views, then revert.
    view.setTitle("uk.co.chrisjenx.calligraphy:toolbar_title");
    view.setSubtitle("uk.co.chrisjenx.calligraphy:toolbar_subtitle");

    // Iterate through the children to run post inflation on them
    final int childCount = view.getChildCount();
    for (int i = 0; i < childCount; i++) {
      onViewCreated(view.getChildAt(i), view.getContext(), null);
    }
    // Remove views from view if they didn't have copy set.
    view.setTitle(previousTitle);
    view.setSubtitle(previousSubtitle);
  }
}

代码示例来源:origin: zulip/zulip-android

@Override
  public void onClick(View v) {
    String message = String.valueOf(toolbar.getTitle());
    if (toolbar.getSubtitle() != null) {
      message += " \u203a " + toolbar.getSubtitle();
    }
    Toast.makeText(ZulipActivity.this, message, Toast.LENGTH_SHORT).show();
  }
});

代码示例来源:origin: jbruchanov/AnUitor

result.put("NavigationIcon:", view.getNavigationIcon());
result.put("PopupTheme", IdsHelper.getNameForId(view.getPopupTheme()));
result.put("Subtitle", view.getSubtitle());
result.put("Title", view.getTitle());
result.put("HasExpandedActionView", view.hasExpandedActionView());

相关文章

Toolbar类方法