Là một phần của giao diện người dùng lớn hơn, tôi có một số RelativeLayout
với ba Chế độ xem mà tôi muốn có cùng chiều rộng. Ba quan điểm được "chồng" trên đầu trang của mỗi khác như thế nàyCách tạo nhiều Chế độ xem có cùng chiều rộng?
ImageView
TextView
ImageView
Tôi đã thử mọi thứ khác nhau như thiết lập các View
s'android:layout_width
để "wrap_content", đặt android:layout_width
thành "0px" và android:layout_weight
thành "1" theo đề xuất của this answer và đặt View
s trong một LinearLayout
không thành công.
Làm cách nào để có được ba chế độ xem này có cùng chiều rộng?
phần có liên quan của xml bố trí:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1">
<ImageView
android:layout_above="@string/window_text"
android:layout_below="@string/eighteen_id"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="5dp"
android:layout_alignParentRight="true"
android:paddingBottom="5dp"
android:src="@drawable/line1"
android:id="@string/line_1_id"/>
<TextView
android:layout_above="@string/line_2_id"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="right"
android:layout_centerVertical="true"
android:textColor="#000000"
android:id="@string/window_text"/>
<ImageView
android:layout_above="@string/top_row_id"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:src="@drawable/line1"
android:id="@string/line_2_id"/>
</RelativeLayout>
Bạn đang hiển thị một RelativeLayout, không phải là một LinearLayout? –
Tôi có một vài 'Chế độ xem' khác trong «RelativeLayout' này sử dụng vị trí tương đối. –