Emy Watson
Emy Watson

Reputation: 71

Marquee won't scroll when using short text

I want to use the marquee property for short texts. I wrote this code:

<TextView
        android:id="@+id/MarqueeText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:freezesText="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:paddingLeft="15dip"
        android:paddingRight="15dip"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="Hello" >

and it doesn't work. But when I changed the text as "hello hello hello hello hello etc." (long text) it works. How can I use marquee for short texts?

Upvotes: 2

Views: 1911

Answers (1)

Paul Burke
Paul Burke

Reputation: 25584

Instead of fill_parent for your layout_width, use a set width. The marquee is enabled when the characters are longer than the View's width.

Upvotes: 6

Related Questions