Tuesday, 14 July 2015

Marquee in android


Marquee in Android


In xml file you enter the this code:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/mywidget"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:lines="1"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:textColor="#ff4500"
        android:singleLine="true"
        android:text="Simple application that shows how to use marquee, with a long text" />
</RelativeLayout>

In java file you enter this code:

textView =(TextView) rootView.findViewById(R.id.mywidget);
 textView.setSelected(true);

No comments:

Post a Comment