Skip to content Skip to sidebar Skip to footer

Simple Android Scrolling Text Ticker

I want to create a scrolling text ticker for a simple android app. I have a large list of quotes stored in an array, and I would like to randomly populate my ticker with the quote

Solution 1:

If I'm understand what you're trying to do properly you want to look at the ellipsize and marqueeRepeatLimit properties of TextView.

Via the API:

http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize

http://developer.android.com/reference/android/widget/TextView.html#attr_android:marqueeRepeatLimit

Also, look at this question for an implementation. From what I remember when I had to implement something like this is that the XML properties can be tricky. They interfere with one another and prevent the text from scrolling across the screen so it may take some toying with to get it right.

From there, populating it with different quotes is as simple as calling setText() on the TextView with the random quote that I assume you'll have stored in an array or database at the proper time.

Post a Comment for "Simple Android Scrolling Text Ticker"