TextView 的文字大小动画 [英] animation of TextView's text size

查看:25
本文介绍了TextView 的文字大小动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够制作文本动画并更改 TextView 中文本的大小.我读到 android 中有属性动画,但如果有人知道可以为我执行此操作的简单代码或某个地方的示例,我将非常感激.提前谢谢你!

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

<?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>

一个函数变成一个Activity:

A function into an Activity:

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);
}

这里中提取和修改

这篇关于TextView 的文字大小动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆