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

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

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

Toolbar.getTitle介绍

暂无

代码示例

代码示例来源: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 isActionBarTitle(TextView view) {
  if (matchesResourceIdName(view, ACTION_BAR_TITLE)) return true;
  if (parentIsToolbarV7(view)) {
    final android.support.v7.widget.Toolbar parent = (android.support.v7.widget.Toolbar) view.getParent();
    return TextUtils.equals(parent.getTitle(), view.getText());
  }
  return false;
}

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

result.put("PopupTheme", IdsHelper.getNameForId(view.getPopupTheme()));
result.put("Subtitle", view.getSubtitle());
result.put("Title", view.getTitle());
result.put("HasExpandedActionView", view.hasExpandedActionView());
result.put("IsOverflowMenuShowing", view.isOverflowMenuShowing());

代码示例来源:origin: VyacheslavShmakin/GpCollapsingToolbar

if (mCollapsingTitleEnabled && TextUtils.isEmpty(mCollapsingTextHelper.getText())) {
  mCollapsingTextHelper.setText(mToolbar.getTitle());

代码示例来源: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: opacapp/multiline-collapsingtoolbar

if (mCollapsingTitleEnabled && TextUtils.isEmpty(mCollapsingTextHelper.getText())) {
  mCollapsingTextHelper.setText(mToolbar.getTitle());

代码示例来源: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: kioko/android-liveData-viewModel

@Override
public boolean matchesSafely(Toolbar toolbar) {
  return textMatcher.matches(toolbar.getTitle());
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@SuppressWarnings("inlineValue")
public static TextView setToolbarTypeface(Toolbar toolbar) {
  for (int i = 0; i < toolbar.getChildCount(); i++) {
    View view = toolbar.getChildAt(i);
    if (view instanceof TextView) {
      TextView textView = (TextView) view;
      if (textView.getText().equals(toolbar.getTitle())) {
        Typeface typeface = ResourcesCompat
            .getFont(toolbar.getContext(), R.font.roboto_mono_medium);
        textView.setTypeface(typeface);
        return textView;
      }
    }
  }
  return null;
}

代码示例来源:origin: mzelzoghbi/ZGallery

@Override
  public void onClick(int pos) {
    ZGallery.with(this, imageURLs)
        .setToolbarTitleColor(ZColor.WHITE)
        .setToolbarColorResId(toolbarColorResId)
        .setSelectedImgPosition(pos)
        .setTitle(mToolbar.getTitle().toString())
        .show();
  }
}

代码示例来源:origin: XiqingLiu/GEEK

/**
 * 在有上一页的时候返回上一页
 */
@Override
public void onBackPressed() {
  if (mWebView.canGoBack()) {
    mWebView.goBack();
    mWebView.getUrl();
    mToolbar.setLogo(R.mipmap.close);
    mToolbar.setTitle("  " + mToolbar.getTitle());
    if (type == WebType.WEB_DETAIL) {
      mWebView.setVisibility(View.INVISIBLE);
    }
  } else {
    super.onBackPressed();
  }
}

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

@Test
public void shouldTransformToolbar() {
  Context context = getContext();
  View view = transformer.transform(new Toolbar(context), getAttributeSet(false));
  assertTrue(view instanceof Toolbar);
  assertEquals(((Toolbar) view).getTitle(), TITLE_ATTR_VALUE);
  view = transformer.transform(new Toolbar(context), getAttributeSet(true));
  assertTrue(view instanceof Toolbar);
  assertEquals(((Toolbar) view).getTitle(), TITLE_ATTR_VALUE);
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

final String toolbarTitle = String.valueOf(toolbar.getTitle());

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

assertThat("Toolbar[title]", ((Toolbar) view).getTitle().toString(), startsWith(getLanguage()));
} else if (view instanceof android.support.v7.widget.Toolbar) {
  assertThat("Toolbar[title]", ((android.support.v7.widget.Toolbar) view).getTitle().toString(), startsWith(getLanguage()));
} else if (view instanceof BottomNavigationView) {
  BottomNavigationView bottomNavigationView = (BottomNavigationView) view;

相关文章

Toolbar类方法