zl程序教程

您现在的位置是:首页 >  其它

当前栏目

跳动的文字

文字 跳动
2023-09-14 08:59:11 时间

效果图:

 

Github地址:https://github.com/frakbot/JumpingBeans
Demo地址:http://play.google.com/store/apps/details?id=net.frakbot.jumpingbeans.demo

步骤:

1.gradle中

dependencies {
    compile 'net.frakbot:jumpingbeans:1.3.0'
}

2.两种效果

(1)文字后添加三个点

final TextView textView1 = (TextView) findViewById(R.id.jumping_text_1);
jumpingBeans1 = JumpingBeans.with(textView1)
        .appendJumpingDots()
        .build();

(2)指定两个位置之间跳动

final TextView textView2 = (TextView) findViewById(R.id.jumping_text_2);
jumpingBeans2 = JumpingBeans.with(textView2)
        .makeTextJump(0, textView2.getText().toString().indexOf(' '))
        .setIsWave(false)
        .setLoopDuration(1000)  // ms
        .build();