Tôi có bố cục có ba phần tử và hướng của nó là 'ngang'android weightSum không hoạt động đúng cách
Tôi muốn sửa kích thước mà mỗi phần tử chiếm trong bố cục của tôi.
yếu tố đầu tiên sẽ chiếm 40% tổng không gian, sau đó phần tử thứ hai phải chiếm 5% và phần thứ ba sẽ chiếm 55% không gian còn lại.
nhìn bố trí của tôi như thế này:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:id="@+id/outletname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="40"
android:text="@string/outlet_name2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="5"
android:text=": " />
<TextView
android:id="@+id/outletnamevalue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="55"
android:text="abcdefttt" />
</LinearLayout>
</LinearLayout>
văn bản trong 'TextView' sẽ thay đổi tự động, Vì vậy, tôi muốn giữ không gian liên tục cho các yếu tố không phụ thuộc vào nội dung trong quan điểm ...
để hoàn thành câu trả lời, người ta phải hiểu rằng trọng lượng chỉ áp dụng cho/còn/không gian, ví dụ: không gian còn lại khi giá trị layout_width đã được áp dụng. – njzk2
điều này làm cho ngày của tôi: D trong bao nhiêu năm ... LOL. vì vậy đó là câu trả lời duy nhất về vấn đề này. UPVOTEEEEEEE – jace