Android Marquee

Jomia picture Jomia · Dec 3, 2010 · Viewed 24.1k times · Source

Is there any working example for Marquee in android? I went through some sites, but that examples are not working.

Thank you for the answers.. But the following code is not working anyway. I am using Android 2.2.

       <TextView    
             android:singleLine="true"  
             android:ellipsize="marquee" 
             android:marqueeRepeatLimit ="marquee_forever"
             android:text="Marquee.."/> 

Answer

radley picture radley · Mar 23, 2011

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);