Android Marquee [duplicate] Android Marquee [duplicate] android android

Android Marquee [duplicate]


it's easy to do via XML. Use the following settings:

android:singleLine="true"android:ellipsize="marquee"android:marqueeRepeatLimit="marquee_forever"android:focusable="false"android:scrollHorizontally="true"

If your TextView is within a RelativeLayout, the width or height will have to be static (i.e. 32dp). If you need dynamic, place the TextView in another View within the RelativeLayout.

In onCreate(), you need to make the TextView selected:

myTextView.setSelected(true);


The code lines you were missing are :

    android:focusable="true"    android:focusableInTouchMode="true"    android:singleLine="true"

In the text field try this text as it is a long text.

android:text="This is a very long text which is not fitting in the screen so it needs to be marqueed."

Check my complete code and step by step process here


You have forgotten to do this in java..

tv.setSelected(true);

and the xml will be

android:scrollHorizontally="true"android:singleLine="true"android:ellipsize="marquee"android:focusable="false"android:marqueeRepeatLimit="marquee_forever"