Мне нужно выполнить следующий макет:
У меня есть два TextViews в относительном макете: зеленый - это фиксированный текст с wrap_content
, черный имеет динамический текст с wrap_content
. Черный текст может измениться и стать очень длинным. Я хочу, чтобы черный TextView расширялся с текстом, пока зеленый вид не достигнет конца родителя. Если это произойдет, черный TextView должен прекратить расширять и эллипсировать конец.
Как я могу это достичь?
Что я пробовал:
<RelativeLayout
android:id="@+id/parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/leftTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:layout_alignParentLeft="true"
android:textSize="18sp" />
<TextView
android:id="@+id/rightTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/leftTextView"
android:textSize="18sp" />
</RelativeLayout>
Но когда черный текст становится все больше и больше, он выталкивает зеленый из вида