TextView Marquee not working

working now :) Code attached below

<TextView
    android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
    android:id="@+id/MarqueeText" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:singleLine="true"
    android:ellipsize="marquee" 
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true" 
    android:paddingLeft="15dip" 
    android:paddingRight="15dip" 
    android:focusable="true" 
    android:focusableInTouchMode="true" 
    android:freezesText="true">

Edit (on behalf of Adil Hussain):

textView.setSelected(true) needs to be set in code behind for this to work.


These attributes must be included in the textview tag in order to allow scrolling.

Everything else is optional.

android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="fill_parent"
android:ellipsize="marquee"

android:singleLine="true"
android:ellipsize="marquee"

are the only required attributes and scrolling even works with layout_weight defined with layout_width=0dp

here is some sample code:

<TextView 
            android:id="@+id/scroller"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#FFFFFF"
            android:text="Some veryyyyy long text with all the characters that cannot fit in screen, it so sad :( that I will not scroll"
            android:layout_marginLeft="4dp"
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            />

But what is most important is implicitely or explicitely TextView should get selected.

You can do this with:

TextView txtView=(TextView) findViewById(R.id.scroller);
txtView.setSelected(true);