Android 超简单文字逐个打出效果-TextScrollView

重写onDraw,绘制文本


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawText(drawText, 0, progress, getWidth() / 2 - widthText / 2, getHeight() / 2, paint);
    }

添加属性动画

ObjectAnimator an = ObjectAnimator.ofInt(view, "progress", 0, drawText.length());
        an.setStartDelay(1000);
        an.setDuration(2000);
        an.start();

没错,就是如此简单

GitHub地址

 

你可能感兴趣的:(Android 超简单文字逐个打出效果-TextScrollView)