Search code examples
androidandroid-layouttextviewleanback

TextView ellipsize - marquee lagging


I have an app for tv. This is an item of the list. Once some item focused I scale it(tried scale using v.animate.scale and using leanback row effect ->ListRowPresenter(FocusHighlight.ZOOM_FACTOR_SMALL) So after any of those ways for scaling my textView start lagging during ellipsize="marquee". I'm 100% sure that it's connected as once disable scaling working perfectly. Maybe someone saw a similar issue? and what possible way to solve this ANDROID bug?

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <RelativeLayout
        android:id="@+id/main_container"
        android:layout_width="120dp"
        android:layout_height="wrap_content"
        android:layoutDirection="ltr"
        android:padding="1dp">

        <RelativeLayout
            android:id="@+id/..."
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            ...
        </RelativeLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/..."
            android:layout_alignStart="@+id/..."
            android:layout_alignEnd="@+id/..."
            android:orientation="vertical">

            <TextView <!--HERE!!!!!-->

                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="marquee"
                android:gravity="center_horizontal"
                android:paddingTop="2dp"
                android:singleLine="true"
                android:text="Name"
                android:textColor="@android:color/white"
                android:textSize="14sp" />
        </LinearLayout>

    </RelativeLayout>
</layout>

Solution

  • If SOMEONE NEED SOLUTION, just ignore the scale for your text(container)

                var parentScale:Float = 1f
                baseView.animate().scaleX(parentScale)
                baseView.animate().scaleY(parentScale)
                val childScale: Float = 1.0f / parentScale
                ignoreView?.animate()?.scaleX(childScale)
                ignoreView?.animate()?.scaleY(childScale)
    

    Text Scrolling without any lags.