2


I searched for a solution online but can't seem to find one.
I have a LinearLayout with 2 TextView that contain text that does not fit and should scroll within the TextView. Using the typical solution only one scrolls. I want both of them to scroll.
My xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/pl_name1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:gravity="center"
        android:marqueeRepeatLimit="marquee_forever"
        android:padding="5dp"
        android:scrollHorizontally="true"
        android:text="A very long piece of text that it is not going to fit the screen"
        android:singleLine="true" />

    <TextView
        android:id="@+id/pl_name2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:gravity="center"
        android:marqueeRepeatLimit="marquee_forever"
        android:padding="5dp"
        android:scrollHorizontally="true"
        android:text="Another very long piece of text that it is not going to fit the screen"
        android:singleLine="true" />
</LinearLayout>

Result:

Layout

How can I achieve what I want, or what am I doing wrong? Thanks in advance.

cosmincalistru
  • 1,283
  • 9
  • 20

0 Answers0