Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marquee not working while using in multiple textviews

I am using marquee in two different TextViews of my widget.But it is working only either for first or the second TextView when i am trying with different combinations of "android:focusable="true"",android:focusableInTouchMode="true" and android:duplicateParentState="true". I want both of the TextViews to be moving. I am giving below the code I am using .

<TextView
        android:id="@+id/place"
        android:layout_width="94dip"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dip"
        android:ellipsize="marquee"            
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"            
        android:lines="1"
        android:textColor="@color/white"
        android:focusable="true"
        android:focusableInTouchMode="true"
        >

        <requestFocus
            android:duplicateParentState="true"
             />
    </TextView>

    <TextView
        android:id="@+id/weather_report"
        android:layout_width="110dip"
        android:layout_height="wrap_content"
        android:layout_below="@+id/place"
        android:ellipsize="marquee"            
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:lines="1"
        android:textColor="@color/grey"
        android:focusable="true"
        android:focusableInTouchMode="true"           
        >
        <requestFocus
            android:duplicateParentState="true"
            /> 
    </TextView>

Can anyone know the solution?

like image 387
YshakPK Avatar asked Feb 05 '26 18:02

YshakPK


1 Answers

I'm pretty sure you can't do what you want. Only focused views can "marquee", and since you cannot have two focused views then it's impossible to do what you want out of the box. However, you can look at the startMarquee() method in the TextView and extend a custom TextView that always marquees.

like image 123
dmon Avatar answered Feb 12 '26 09:02

dmon