Auto Scroll Text View

Description:
This example will show how to set auto scroll in text view in android.

Algorithm:

  1. Create a new project by File-> New -> Android Project name it AutoScrollTextView.
  2. Write following into main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AutoScrollTextViewActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<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="Hello Android.. I am android developer and developing this auto scroll text view via XML." />

</LinearLayout>

 

  1. Run for output.

Steps:

  1. Create a project named AutoScrollTextView and set the information as stated in the image.

Build Target: Android 4.2
Application Name: AutoScrollTextView
Package Name: com.example.AutoScrollTextView
Activity Name: AutoScrollTextViewActivity

 

 

 

 

 

 

 

 

 

  1. Compile and build the project.

Output

Leave a Comment:

1 comment
abner says August 31, 2013

This is a horizontal scroll simple,but how to a vertical

Reply
Add Your Reply