android.widget.TextView.getLineSpacingExtra()方法的使用及代码示例

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

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

TextView.getLineSpacingExtra介绍

暂无

代码示例

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

@TargetApi(JELLY_BEAN)
public S hasLineSpacingExtra(float extra) {
 isNotNull();
 float actualExtra = actual.getLineSpacingExtra();
 assertThat(actualExtra) //
   .overridingErrorMessage("Expected line spacing extra <%s> but was <%s>.", extra,
     actualExtra) //
   .isEqualTo(extra);
 return myself;
}

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

mTextView.getPaint(),
    mTextView.getLineSpacingMultiplier(),
    mTextView.getLineSpacingExtra(),
    mTextView.getIncludeFontPadding());
update();

代码示例来源:origin: dongorigin/AndroidDemo

@Override
  public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    int size = Integer.parseInt(mSizeEdit.getText() != null ? mSizeEdit.getText().toString() : "20");
    float mult = Float.parseFloat(mLineEdit.getText() != null ? mLineEdit.getText().toString() : "1.3");
    int padding = Integer.parseInt(mPaddingEdit.getText() != null ? mPaddingEdit.getText().toString() : "25");
    int dp25 = PixelUtils.dp2px(25);
    padding = PixelUtils.dp2px(padding);
    mOneTextView.setTextSize(size);
    mOneTextView.setLineSpacing(mOneTextView.getLineSpacingExtra(), mult);
    mOneTextView.setPadding(padding, dp25, padding, dp25);
    mTwoTextView.setTextSize(size);
    mTwoTextView.setLineSpacing(mTwoTextView.getLineSpacingExtra(), mult);
    mTwoTextView.setPadding(padding, dp25, padding, dp25);
    CommonUtils.hideSoftInput(mContext, mPaddingEdit);
    return true;
  }
});

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

@TargetApi(JELLY_BEAN)
public S hasLineSpacingExtra(float extra) {
 isNotNull();
 float actualExtra = actual.getLineSpacingExtra();
 assertThat(actualExtra) //
   .overridingErrorMessage("Expected line spacing extra <%s> but was <%s>.", extra,
     actualExtra) //
   .isEqualTo(extra);
 return myself;
}

代码示例来源:origin: bignerdranch/Typesetter

private void initializeLineSpacing() {
  float lineSpacing = binding.fillerTextView.getLineSpacingExtra();
  lineSpacing = lineSpacing / getResources().getDisplayMetrics().scaledDensity;
  binding.lineSpacingEditText.setText(formatFloat(lineSpacing));
}

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

private void TextMeasure(String text,
             TextView tvl, TextView tvr) {
  int linesPerScreen = tvl.getHeight() / (tvl.getLineHeight() + (int) tvl.getLineSpacingExtra());
  Paint paint = tvl.getPaint();
  int textWidth = paint.breakText(text, 0, text.length(),
      true, tvl.getWidth(), null);
  int totalText = textWidth * linesPerScreen;
  String leftText = text.substring(0, totalText);
  String rightText = text.substring(totalText,
      text.length());
  tvl.setText(leftText);
  tvr.setText(rightText);
}

代码示例来源:origin: GrossumUA/TAS_Android_Boilerplate

private static void applyFixForPre21ver(TextView tv) {
    int paddingBottom = tv.getPaddingBottom();
    paddingBottom = paddingBottom - (int) tv.getLineSpacingExtra();
    tv.setPadding(tv.getPaddingLeft(), tv.getPaddingTop(), tv.getPaddingRight(), paddingBottom);
  }
}

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

values.put("LineSpacingExtra", tv.getLineSpacingExtra());
values.put("LineSpacingMultiplier", tv.getLineSpacingMultiplier());
values.put("MaxLines", tv.getMaxLines());

代码示例来源:origin: shazam/reflow-animator

private static Layout createUnrestrictedLayout(@Nonnull TextView view) {
  CharSequence text = view.getText();
  Layout layout = view.getLayout();
  TextPaint paint = layout.getPaint();
  if (SDK_INT >= M) {
    return StaticLayout.Builder
        .obtain(text, 0, text.length(), layout.getPaint(), layout.getWidth())
        .setAlignment(layout.getAlignment())
        .setLineSpacing(view.getLineSpacingExtra(), view.getLineSpacingMultiplier())
        .setIncludePad(view.getIncludeFontPadding())
        .setBreakStrategy(view.getBreakStrategy())
        .setHyphenationFrequency(view.getHyphenationFrequency())
        .build();
  } else {
    return new StaticLayout(
        text,
        paint,
        text.length(),
        layout.getAlignment(),
        view.getLineSpacingMultiplier(),
        view.getLineSpacingExtra(),
        view.getIncludeFontPadding());
  }
}

代码示例来源:origin: darkskygit/VirtualApp

layout = new StaticLayout(text, paint, getTextWidth(textView),
    getLayoutAlignment(textView), textView.getLineSpacingMultiplier(),
    textView.getLineSpacingExtra(), textView.getIncludeFontPadding());

代码示例来源:origin: bzsome/VirtualApp-x326

layout = new StaticLayout(text, paint, getTextWidth(textView),
    getLayoutAlignment(textView), textView.getLineSpacingMultiplier(),
    textView.getLineSpacingExtra(), textView.getIncludeFontPadding());

相关文章

TextView类方法