0

Inside my RecycleView Im trying to marquee all the texts that doesn't fit in one line, however due to lack of focus inside RecycleView, I can only set one Textview to work, is there any way to do it?

    <TextView
        android:layout_toLeftOf="@+id/imageLabel"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:scrollHorizontally="true"
        android:freezesText="true"
        android:maxLines="1"
        android:id="@+id/bankName"
        android:paddingRight="5dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="@android:color/black"
        android:textSize="28sp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />

I know if I add

 android:singleLine="true"

it would make all the Textviews marquee inside the recyclerview, but since its depercated I want to avoid using it

George2456
  • 340
  • 5
  • 19

1 Answers1

2

Based on this link

attribute singleline is deprecated for its bad performance.

But I used "textview.setSingleLine();" instead, and there's no deprecation warning(neither in source code). So I assume this may work.

Of course alternative way is the same as countdown timer in a list, and a custom view should be necessary but cannot avoid ton's work on it.

Community
  • 1
  • 1
machinezhou
  • 679
  • 2
  • 6
  • 16