Tôi có relativelayout và trong đó có hai bản xem trước. Textview 1 được căn chỉnh trên cùng và bên trái với cha mẹ. Textview 2 được căn chỉnh ở bên phải của chế độ xem văn bản 1 và ở bên phải với bố cục. Điều này tạo ra một vấn đề nếu văn bản trong 1 quá dài, có nghĩa là 1 sẽ đẩy 2 ra khỏi trường hợp xấu nhất của màn hình.TextView và Ellipsize khi được ép bởi TextView khác
Làm cách nào để tôi có được hai điều này để "hy sinh" từ văn bản nr 1 thay vì 2? chiều rộng tối thiểu dường như không hoạt động. Mục tiêu cuối cùng của tôi là để ellipsize văn bản 1, nhưng dường như bản lề trên textview có kích thước chính xác ở nơi đầu tiên.
Đây là xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/TextView02"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/TextView01"
android:text="I am number 2"
android:gravity="right"
android:lines="1"
android:minWidth="32sp">
</TextView>
<TextView android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="@+id/TextView01"
android:layout_alignParentLeft="true"
android:textSize="22sp"
android:layout_width="wrap_content"
android:lines="1"
android:text="sd sd asd sad asd asd saasd a">
</TextView>
</RelativeLayout>
Thực ra, điều này hoàn toàn được trả lời bởi câu hỏi này: http://stackoverflow.com/questions/3785221/two-textviews-side-by-side-only-one-to-ellipsize – sandos