I have a horizontal Linear Layout with two texts, and i want to make them both visible, but since The size of the first text may vary in size, i have 2 conditions to fulfill on this scenario:
- In cases the first text is a long text, i want to display the texts like following:
|[text1 long long lo...][text2]|
- In cases the first text is a short text, i want to display the texts like following:
|[text1][text2]_______________|
So i decided to use the marquee repeat animation on the first text, used weight in this text to fulfill the first condition, and a wrap_content on the Linear Layout to fulfill the second condition. But this makes the marquee animation to reset when another text view is updated, which is unacceptable in my app. I've been trying a lot of stuff, but i don't seems to be able to produce this behavior.
Do you guys think it's possible to fix this problem?
Thanks for anyone who answers this question
Here's a example code:
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewFirst"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/roboto_regular"
android:textSize="32sp"
android:text="May be a very very very long text view"
android:lineHeight="37.504dp"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever" />
<TextView
android:id="@+id/textViewSecond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/transparentWhite"
android:fontFamily="@font/roboto_regular"
android:textSize="32sp"
android:text=" short text"
android:lineHeight="37.504dp" />
</LinearLayout>