Reputation: 3155
I have a TextView with a maxWidth that I want to loop its text in an animation, if the text is too long to fit in this width.
I want this animation to be smooth, infinite, and to have a certain margin between the end of the text to the beginning of the text in the next animation phase.
For example, if my text is:
"And I think to myself what a wonderful world"
, and in a normal single-line+ellipsize TextView configuration it will look like:
[Beginning of TextView]And I think to myself wh...[End of TextView]
Then I want the text to start animating from left to right, until the whole text is shown, and then again (after a certain margin to the beginning of the text).
What is the simplest way to do this? I've looked for it but couldn't find anything promising.
Upvotes: 0
Views: 671
Reputation: 13172
You can add
android:scrollHorizontally="true"
android:ellipsize="marquee"
to your TextView
Note: for it to work, you have to select it in your code:
textView.setSelected(true);
Of course if you need something more customizable and elaborate this may not suits you.
Upvotes: 2