android.graphics.Typeface.isBold()方法的使用及代码示例

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

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

Typeface.isBold介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public TypefaceAssert isBold() {
 isNotNull();
 assertThat(actual.isBold()) //
   .overridingErrorMessage("Expected to be bold but was not.") //
   .isTrue();
 return this;
}

代码示例来源:origin: square/assertj-android

public TypefaceAssert isNotBold() {
 isNotNull();
 assertThat(actual.isBold()) //
   .overridingErrorMessage("Expected to not be bold but was.") //
   .isFalse();
 return this;
}

代码示例来源:origin: facebook/facebook-android-sdk

if (typeface != null) {
  textStyle.put(TEXT_SIZE, textView.getTextSize());
  textStyle.put(TEXT_IS_BOLD, typeface.isBold());
  textStyle.put(TEXT_IS_ITALIC, typeface.isItalic());
  json.put(TEXT_STYLE, textStyle);

代码示例来源:origin: ankidroid/Anki-Android

if (tf.isBold() || name.toLowerCase(Locale.US).contains("bold")) {
  attributes.add("font-weight: bolder;");
  family = family.replaceFirst("(?i)-?Bold", "");

代码示例来源:origin: eleme/UETool

@Override
  public List<Item> getAttrs(Element element) {
    List<Item> items = new ArrayList<>();
    TextView textView = ((TextView) element.getView());
    items.add(new TitleItem("TextView"));
    items.add(new EditTextItem("Text", element, EditTextItem.Type.TYPE_TEXT, textView.getText().toString()));
    items.add(new AddMinusEditItem("TextSize(sp)", element, EditTextItem.Type.TYPE_TEXT_SIZE, px2sp(textView.getTextSize())));
    items.add(new EditTextItem("TextColor", element, EditTextItem.Type.TYPE_TEXT_COLOR, Util.intToHexColor(textView.getCurrentTextColor())));
    List<Pair<String, Bitmap>> pairs = Util.getTextViewBitmap(textView);
    for (Pair<String, Bitmap> pair : pairs) {
      items.add(new BitmapItem(pair.first, pair.second));
    }
    items.add(new SwitchItem("IsBold", element, SwitchItem.Type.TYPE_IS_BOLD, textView.getTypeface() != null ? textView.getTypeface().isBold() : false));
    return items;
  }
}

代码示例来源:origin: florent37/FiftyShadesOf

@Override
public void beforeStart() {
  super.beforeStart();
  this.textColor = view.getTextColors();
  this.darker = view.getTypeface() != null && view.getTypeface().isBold();
}

代码示例来源:origin: org.arakhne.afc.ui/vector-android

@Override
public boolean isBold() {
  Typeface tf = this.paint.getTypeface();
  if (tf==null) tf = Typeface.DEFAULT;
  return tf.isBold();
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public TypefaceAssert isBold() {
 isNotNull();
 assertThat(actual.isBold()) //
   .overridingErrorMessage("Expected to be bold but was not.") //
   .isTrue();
 return this;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public TypefaceAssert isNotBold() {
 isNotNull();
 assertThat(actual.isBold()) //
   .overridingErrorMessage("Expected to not be bold but was.") //
   .isFalse();
 return this;
}

代码示例来源:origin: org.arakhne.afc.ui/vector-android

@Override
public boolean isPlain() {
  Typeface tf = this.paint.getTypeface();
  if (tf==null) tf = Typeface.DEFAULT;
  return !tf.isBold() && !tf.isItalic();
}

代码示例来源:origin: com.google.android.apps.common.testing.accessibility.framework/accessibility-test-framework

/**
  * Given a TextView, returns true if it contains text which is large for contrast purposes as
  * defined at http://www.w3.org/TR/2008/REC-WCAG20-20081211/#larger-scaledef
  */
 private static boolean isLargeText(TextView textView) {
  float textSize = textView.getTextSize();
  if ((textSize >= ContrastUtils.WCAG_LARGE_TEXT_MIN_SIZE) || (
    (textSize >= ContrastUtils.WCAG_LARGE_BOLD_TEXT_MIN_SIZE)
    && textView.getTypeface().isBold())) {
   return true;
  }
  return false;
 }
}

代码示例来源:origin: MarcinOrlowski/Fonty

if (currentTypeface.isBold()) {
  key = Fonty.TYPE_BOLD;
  if (typefaceFallback) {

代码示例来源:origin: openmrs/openmrs-contrib-android-client

private static void setTypeface(TextView textView) {
  if (textView != null) {
    if (textView.getTypeface() != null && textView.getTypeface().isBold()
                     && textView.getTypeface().isItalic()) {
      textView.setTypeface(getOpenTypeface(OpenFonts.OPEN_SANS_BOLD_ITALIC));
    } else if (textView.getTypeface() != null && textView.getTypeface().isItalic()) {
      textView.setTypeface(getOpenTypeface(OpenFonts.OPEN_SANS_ITALIC));
    } else if (textView.getTypeface() != null && textView.getTypeface().isBold()) {
      textView.setTypeface(getOpenTypeface(OpenFonts.OPEN_SANS_BOLD));
    } else {
      textView.setTypeface(getOpenTypeface(OpenFonts.OPEN_SANS_REGULAR));
    }
  }
}

代码示例来源:origin: blurpy/kouchat-android

private boolean userIsBold(final String nickName, final int userNumber) {
  solo.sleep(500);
  assertEquals(nickName, getUserNameAtPosition(userNumber));
  final LinearLayout row = (LinearLayout) getUserList().getChildAt(userNumber);
  final TextView textView = (TextView) row.getChildAt(1);
  final Typeface typeface = textView.getTypeface();
  return typeface != null && typeface.isBold();
}

代码示例来源:origin: googleads/googleads-mobile-android-mediation

if (typeface != null) {
  Bundle typefaceBundle = new Bundle();
  typefaceBundle.putBoolean(KEY_IS_BOLD, typeface.isBold());
  typefaceBundle.putBoolean(KEY_IS_ITALIC, typeface.isItalic());
  typefaceBundle.putInt(KEY_STYLE, typeface.getStyle());

相关文章