/**
* Re size the font so the specified text fits in the text box assuming the text box is the
* specified width.
*/
private void refitText() {
CharSequence text = getText();
if (TextUtils.isEmpty(text)) {
return;
}
TransformationMethod method = getTransformationMethod();
if (method != null) {
text = method.getTransformation(text, this);
}
int targetWidth = getWidth() - getPaddingLeft() - getPaddingRight();
if (targetWidth > 0) {
float high = 100;
float low = 0;
mPaint.set(getPaint());
mPaint.setTextSize(getTextSize());
float letterSpacing = getLetterSpacing(text, mPaint, targetWidth, low, high,
mPrecision);
mPaint.setLetterSpacing(letterSpacing);
calculateSections(text);
super.setLetterSpacing(letterSpacing);
}
}
AutoExpandTextView.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Trebuchet
作者:
评论列表
文章目录