Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

android - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...