Implement auto scroll TextView in XML

Here demonstrate how to implement a auto scroll horizontally TextView in 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=".MainActivity" >

<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 AndroidCoding: http://lesapplication.blogspot.com/" />

</LinearLayout>

auto scroll horizontally TextView


If you define more than one marquee TextView in the layout, only the first one will run. To enable them run together, refer HERE.

0 Response to "Implement auto scroll TextView in XML"

Posting Komentar