Tuesday, July 16, 2013

Implement auto-running TextView



<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello"
        android:textStyle="bold|italic"
        android:layout_gravity="center_horizontal" />

    <TextView
        android:id="@+id/shadowtext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="http://android-er.blogspot.com/"
        android:textStyle="bold"
        android:textSize="50sp"
        android:textColor="#0000ff"
        
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:singleLine="true"
        android:scrollHorizontally="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit ="marquee_forever" />

</LinearLayout>




Updated@2016-08-30:
Have to set the TextView selected also, refer "Auto scrolling (horizontal running) TextView".

1 comment:

Terryboy Victor said...

please how can i make the marquee horizontal? i want the text to move from up to down not left to right.