跑马灯,字体跳动和抖动动画
一.主要是记录我查找资料和研究的字体跳动和抖动动画,废话少说,直接干;
1.主界面代码
public class MainActivity extends AppCompatActivity { private JumpingBeans jumpingBeans1, jumpingBeans2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView text_aaa = (TextView) findViewById(R.id.text_aaa); jumpingBeans1 = JumpingBeans.with(text_aaa)//把这个TextView绑定到JumpingBeans 中 .appendJumpingDots()//只有這個文字后面的"..."跳动,没有"..."默认加上 .build();//判断一系列参数,构建效果并执行(重新对TextView的字符串内容进行拼接) final TextView textView1 = (TextView) findViewById(R.id.jumping_text_1); jumpingBeans1 = JumpingBeans.with(textView1) .makeTextJump(0, textView1.getText().toString().length())////具体动作的哪几个字如传入(0,3)就是第1-第4个字有动画效果 .setIsWave(true)//是否允许有动画 .setLoopDuration(1000)//效果持续的时间,毫秒为单位 .build();//判断一系列参数,构建效果并执行(重新对TextView的字符串内容进行拼接) //上下跳動 // Note that, even though we access textView2's text when starting to work on // the animation builder, we don't alter it in any way, so we're ok final TextView textView2 = (TextView) findViewById(R.id.jumping_text_2); jumpingBeans2 = JumpingBeans.with(textView2) .makeTextJump(0, textView2.getText().toString().indexOf(' ')) .setIsWave(false) .setLoopDuration(1000) .build(); final TextView t