HTextView
HTextView copied to clipboard
The `sextText("")` doesn't work
I'm using the evaporateText and the animateText("") provide the text with the effect but when I open the view i just need to set a text without the effect then I shoud use the `setText" but it does not work and put nothing on the view.
There is a way to use an evaporate with no effects?
Any update on this?
This is because it is overriding the ondraw() method of the class TextView. Use the following class and call MyScaleTextView.animateText(CharSequence text, boolean animate), to display text without any animation.
public class MyScaleTextView extends HTextView {
private ScaleText scaleText;
private boolean animate = true;
public MyScaleTextView(Context context) {
this(context, null);
}
public MyScaleTextView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MyScaleTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
scaleText = new ScaleText();
scaleText.init(this, attrs, defStyleAttr);
setMaxLines(1);
setEllipsize(TextUtils.TruncateAt.END);
}
@Override
public void setAnimationListener(AnimationListener listener) {
scaleText.setAnimationListener(listener);
}
@Override
protected void onDraw(Canvas canvas) {
if (!animate) {
super.onDraw(canvas);
} else {
scaleText.onDraw(canvas);
}
}
@Override
public void setProgress(float progress) {
scaleText.setProgress(progress);
}
@Override
public void animateText(CharSequence text) {
this.animate = true;
scaleText.animateText(text);
}
public void animateText(CharSequence text, boolean animate) {
this.animate = animate;
if (animate){
scaleText.animateText(text);
}else {
setText(text);
}
}
}
I think the developers should also update the library