<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:ellipsize="end" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:maxLines="1" />
</LinearLayout>
但我想text2的有「較高優先級」,比文本1
含義的情況下,屏幕不適合這兩個我需要有這種行爲:
文本2必須始終除非它是屏幕的80%以上,在這種情況下使用完全顯示在一行「...」
Text1使用Text2留下的任何空間,可以使用多行,如果不適合,應該在末尾使用「...」
這是LinearLayout的可能性,或者我應該使用不同的容器呢?
我不知道是否有可能與Android提供任何佈局。你可能必須編寫自定義視圖或以編程方式進行管理...... – xFighter
您是否嘗試過使用'layout_weight'? – yogur
@xFighter我只喜歡xml –