Marquee text not moving inside RecyclerView

31 views Asked by At

Here's my textview :

<TextView
            android:id="@+id/event_cell_title"
            android:layout_width="match_parent"
            android:layout_height="17.5dp"
            android:textSize="13sp"
            android:fontFamily="@font/poppins_regular"
            android:text="Single-line text view that scrolls automatically if the text is too long to fit in the widget"
            android:textColor="@color/black"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@+id/event_cell_cardview"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit="marquee_forever"
            android:singleLine="true"
            android:scrollHorizontally="true"/>

then in the recycler adapter, in this function :

@Override
    public void onBindViewHolder(EventsItemView holder, int position) {
        holder.title.setSelected(true);
        events.get(position).fillEvent(holder, context);
    }

but the text is not moving :(

I want my Textview with marquee to move horizontally when the text is too long

1

There are 1 answers

2
Hezy Ziv On

you can disable the specific view in the recycleView

@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
    if (holder instanceof YourViewHolderType) {
        holder.setIsRecyclable(false);
    }
    super.onViewRecycled(holder);
}