появляются. И я думаю, что идея для решения этой проблемы с помощью LinearLayout может помочь другим людям решить другие проблемы

хочу :

Когда текст короткий, 21%TextView должно быть рядом с первымTextView как ниже

и когда текст длинный, я хочу первыйTextView достичь конца и эллипсиса и 21%TextView должно быть видно, как показано ниже

но что я делаю на 21%TextView уходит и первымTextView занимает полное пространство. Я перепробовал много комбинаций сLinear, Relative, Frame, Constraint layout, weight, minwidth и т. д., но ничего не работает.

Вот мой xml

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

    <TextView
        android:id="@+id/tv_job_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:lines="1"
        android:maxLines="1"
        android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce pulvinar nec justo id bibendum." />

    <TextView
        android:id="@+id/tv_matchPercent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:paddingLeft="5dp"
        android:text="21% "
        android:textColor="#4268e3"/>
</LinearLayout>

Есть идеи, как этого добиться?

Примечание: Я не хочу жестко кодировать символы или ширину

Ответы на вопрос(2)

Ваш ответ на вопрос