Objectives :
– How to use TextView in Android?
– How to scroll Text in Android?
– How to implement Marquee Text in Android?
– How to make text scrollable in Android?
Getting Started :
1. Create a New Android Application titled as “AutoscrollTextviewDemo” with blank activity.
2. Update the layout xml with code given below.
How to do it?
Here is the XML code for Auto Scroll TextView, update your layout xml file with code below.
[code language=”xml” 1=”highlight(14,15,16,17,18)”]
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AutoScroll TextView" />
<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" />
</LinearLayout>
[/code]
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.
Aatul Palandurkar,
thanks for making this article! really useful for me to build my application!
Thanks so much. I’m so happy with using this new method.
You can search my apps on Google Play Store just by searching for ProjectPlay.
Kenny Tam (ProejctPlay Entertainment Studio, Hong Kong)
Hi Kenny,
Glad to hear from you that this post helped you in your project.
I have seen your app too, good job.
Recently, I tried to put 2 auto scroll view on the page but it doesn’t work. Why and how can I fix it ?
It is same at that of earlier. Please check the code again, ping me again if the problem is not solved.