Vertical Maquee TextView

2019-08-24 03:47发布

问题:

From the prevois post, Is there a way to make ellipsize=“marquee” always scroll? I have create a vertical maquee textview. But my question is how can I hold the animation around 5 sec when it moving to a point and than resume and finish the animation.

For example:

mAnimation2 = new TranslateAnimation(0f, 0f, 20f, -20f);
mAnimation2.setDuration(5000);
mAnimation2.setStartOffset(5000); 
mAnimation2.setRepeatMode(Animation.RESTART);
TextView tv = (TextView)findViewById(R.id.text); tv.setAnimation(mAnimation2);

I have define the above animation and set it to TextView. How can I stop the animation 5 sec when the textview was at coordinate (0,0) and than continues the animation?

回答1:

You could take this MarqueeView implementation and customize it up to your desire: http://b.ivity.asia/2010/12/01/extended-marquee-in-android/