How to get a TextView in Android have Horizontal Scrolling and autoscrolled?
I want 开发者_如何学编程to have a simple TextView with horizontal scrolling, I know that I use HorizontalScrollview for that and I want the text to be autoscrolled continuously. Is that possible?
You could use android:ellipsize="marquee" in the TextView attributes or by implement your own animation
This is small example for auto scroll text view simply using XML, no need to code Java. Hope you will like it! Try it on your own, it is very easy to perform
Try this :
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="This is small example for auto scroll text view simply using XML, no need to code Java. Hope you like it! Try it on your own, it is very easy to perform" />
Click here to see the Output
Here text will scroll automatically and you will get infinite scroll. Have fun!
Click here to see detailed tutorial
精彩评论