需求如題
代碼
<LinearLayout
android:layout_width="480dp"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:background="#0ff"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:layout_weight="1"
android:text="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
<TextView
android:background="#0f0"
android:text="Button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:background="#ff0"
android:text="Button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
注意必須使用LinearLayout,相對佈局無法實現該效果。(會出現權重失效)