Srini2k6
Srini2k6

Reputation: 390

android marquee not working

Marquee is not working in textview.I placed the textview inside the TableLoyout between two buttons. And i make the textview as stretchable column. Here is my xml code. I cant figure out the mistake.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#e0bf64" android:orientation="vertical">


<TableLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="2"
    android:background="#f2cd6d">
    <TableRow>
        <Button 
            android:id="@+id/btn_prv" 
            android:text="@string/prv" 
            android:textSize="16sp" 
             android:layout_column="1"
            android:layout_width="100dip"               
            android:background="@drawable/prev_btn_re"
            android:paddingLeft="0sp"
            android:paddingTop="0sp"

        />

        <TextView 
            android:id="@+id/head_title" 
            android:layout_width="125dip"
            android:gravity="center"
            android:paddingLeft="5sp"
            android:paddingTop="10dip"
            android:paddingRight="0sp"
            android:background="#f2cd6d"
            android:textSize="16sp" 
            android:textColor="@color/black"
            android:marqueeRepeatLimit="marquee_forever"
            android:lines="1"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:freezesText="true"
            android:scrollHorizontally="true" 
            android:text="marquee text"

        />

        <Button 
            android:id="@+id/btn_next" 
            android:text="@string/next"
            android:textSize="16sp" 
            android:gravity="right"
            android:layout_width="100dip"
            android:background="@drawable/next_btn_re"
            android:paddingRight="10sp"
            android:paddingTop="5sp"
         />
      </TableRow>
   </TableLayout>
</LinearLayout>

Please any one tell me why its not working?

Upvotes: 2

Views: 2456

Answers (1)

Romain Guy
Romain Guy

Reputation: 98501

A marquee starts when a TextView becomes either focused or selected. You can force it to start by calling setSelected(true) on the TextView.

Upvotes: 22

Related Questions