中的TextView的文字大小动画文字大小、动画、TextView

2023-09-04 04:30:45 作者:比较有意境的,简约有意境的

我希望能够做一个文字动画,改变文本的大小在一个TextView。我看有android的财产的动画,但如果有人知道一个简单的code,可以做到这一点对我来说还是一个例子地方我会深深AP preciate它。感谢ü提前!

I want to be able to do a text animation and change the size of the text in a TextView. I read that there are property animations in android but if someone knows a simple code that can do this for me or an example somewhere I will deeply appreciate it. Thank u in advance!

推荐答案

scale.xml

scale.xml

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
          android:fromXScale="1.0"
          android:fromYScale="1.0"
          android:toXScale="2.0"
          android:toYScale="2.0"
          android:duration="3000"></scale>
</set>

一个功能于活动:

private void RunAnimation() 
{
    Animation a = AnimationUtils.loadAnimation(this, R.anim.scale);
    a.reset();
    TextView tv = (TextView) findViewById(R.id.firstTextView);
    tv.clearAnimation();
    tv.startAnimation(a);
}

提取并从here