Deprecated: How to Make a Scrolling Marquee using singleLine in a TextView
Deprecated because android:singleLine is deprecated. Use, scrollHorizontally instead to make a scrolling marquee.android:ellipsize was added in API Level 1
1. Create an Android project, if you don't already have one.
2. Add a TextView.
3. Limit the number of lines of a TextView using android:singleLine
4. In the main.xml file, add the below line
<TextView
....
android:text="This is a really, really, really long line of text so you can see it scroll.This is a really, really, really long line of text so you can see it scroll."
android:ellipsize = "marquee"
/>
5. If no other widgets are on the screen, this TextView will have focus by default, and will scroll automatically. However, if there are more widgets on the screen, when another widget gets focus, the scrolling will stop on the TextView because it
has lost focus. To keep the focus on the TextView there are four options:
a. add android:state_selected - Set Focus to a TextView, using state_selected, in XML
c. add setSelected(true) - Set Focus to a TextView, using Java
Related Articles:
- android:ellipsize - Make a Scrolling Marque, using scrollHorizontally, in a TextView
- android:ellipsize - Add an ellipsis in a TextView
- Stop a Rolling Marquee on a TextView
- Deprecated: android:singleLine Set EditText to One Horizontally Scrolling Line
- android:maxLines - Set the Maximum Viewable Lines of text in a TextView
- android:lines - Change the number of lines of text viewable in a TextView/EditText
http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize
http://developer.android.com/reference/android/R.attr.html#ellipsize