public class AutoFitHelper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
AutoFitHelper.OnTextSizeChangeListener
文字大小变化的监听
|
| Modifier and Type | Method and Description |
|---|---|
AutoFitHelper |
addOnTextSizeChangeListener(AutoFitHelper.OnTextSizeChangeListener listener)
添加字体大小变化的监听
|
static AutoFitHelper |
create(android.widget.TextView view)
Creates a new instance of
AutofitHelper that wraps a TextView and enables
automatically sizing the text to fit. |
static AutoFitHelper |
create(android.widget.TextView view,
android.util.AttributeSet attrs)
Creates a new instance of
AutofitHelper that wraps a TextView and enables
automatically sizing the text to fit. |
static AutoFitHelper |
create(android.widget.TextView view,
android.util.AttributeSet attrs,
int defStyle)
Creates a new instance of
AutofitHelper that wraps a TextView and enables
automatically sizing the text to fit. |
int |
getMaxLines() |
float |
getMaxTextSize()
获取最大字体大小【单位: px】
|
float |
getMinTextSize()
获取最小字体大小【单位: px】
|
float |
getPrecision() |
float |
getTextSize()
Returns the original text size of the View.
|
boolean |
isEnabled() |
AutoFitHelper |
removeOnTextSizeChangeListener(AutoFitHelper.OnTextSizeChangeListener listener)
删除字体大小变化的监听
|
AutoFitHelper |
setEnabled(boolean enabled)
设置是否开启自适应字体大小的功能
|
AutoFitHelper |
setMaxLines(int lines) |
AutoFitHelper |
setMaxTextSize(float size)
设置自适应的最大字体大小【单位: sp】
|
AutoFitHelper |
setMaxTextSize(int unit,
float size)
设置自适应的最大字体大小
|
AutoFitHelper |
setMinTextSize(float size)
设置自适应的最小字体大小【单位:sp】
|
AutoFitHelper |
setMinTextSize(int unit,
float size)
设置自适应的最小字体大小
|
AutoFitHelper |
setPrecision(float precision)
设置自适应的调整精度(精度值越小,越精准,耗时越长)
|
void |
setTextSize(float size)
Set the original text size of the View.
|
void |
setTextSize(int unit,
float size)
Set the original text size of the View.
|
public static AutoFitHelper create(android.widget.TextView view)
AutofitHelper that wraps a TextView and enables
automatically sizing the text to fit.public static AutoFitHelper create(android.widget.TextView view, android.util.AttributeSet attrs)
AutofitHelper that wraps a TextView and enables
automatically sizing the text to fit.public static AutoFitHelper create(android.widget.TextView view, android.util.AttributeSet attrs, int defStyle)
AutofitHelper that wraps a TextView and enables
automatically sizing the text to fit.public AutoFitHelper addOnTextSizeChangeListener(AutoFitHelper.OnTextSizeChangeListener listener)
listener - public AutoFitHelper removeOnTextSizeChangeListener(AutoFitHelper.OnTextSizeChangeListener listener)
listener - public float getPrecision()
public AutoFitHelper setPrecision(float precision)
precision - 字体调整精度public float getMinTextSize()
public AutoFitHelper setMinTextSize(float size)
size - 字体大小public AutoFitHelper setMinTextSize(int unit, float size)
unit - 单位:px or spsize - 字体大小public float getMaxTextSize()
public AutoFitHelper setMaxTextSize(float size)
size - 字体大小public AutoFitHelper setMaxTextSize(int unit, float size)
unit - 单位:px or spsize - 字体大小public int getMaxLines()
TextView.getMaxLines()public AutoFitHelper setMaxLines(int lines)
TextView.setMaxLines(int)public boolean isEnabled()
public AutoFitHelper setEnabled(boolean enabled)
enabled - 是否开启public float getTextSize()
TextView.getTextSize()public void setTextSize(float size)
TextView.setTextSize(float)public void setTextSize(int unit,
float size)
TextView.setTextSize(int, float)