Tôi đang cố gắng sử dụng lại một số thành phần bố cục trong ứng dụng Android bằng cách sử dụng thẻ <include>
. Tôi đã có cảng và đất khác nhau bố trí:thuộc tính layout_weight trong <include> thẻ
Cảng:
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp"> <include layout="@layout/calc_equals_button" a:layout_weight="4"/> <include layout="@layout/calc_display"/> </LinearLayout>
đất:
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp"> <include layout="@layout/calc_equals_button"/> <include layout="@layout/calc_display"/> </LinearLayout>
khác biệt chính là a:layout_weight="4"
, vì vậy tôi muốn tôi Thành phần calc_equals_button nhỏ hơn trong định hướng cổng.
Vấn đề là nếu tôi cố gắng để nhúng calc_equals_button
thành phần trực tiếp mọi thứ hoạt động OK, ví dụ .:
<LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
<DirectionDragButton
xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/equalsButton"
a:text="="
a:layout_width="match_parent"
a:layout_height="match_parent"
a:layout_weight="4"
style="@style/control_button_style"
a:onClick="numericButtonClickHandler"/>
<include layout="@layout/calc_display"/>
</LinearLayout>
khác - KHÔNG.
Đây là mẫu calc_equals_button.xml:
<DirectionDragButton
xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/equalsButton"
a:text="="
a:layout_width="match_parent"
a:layout_height="match_parent"
style="@style/control_button_style"
a:onClick="numericButtonClickHandler"/>
"Hiện tại" như trong nó sẽ được thay đổi trong ICS? –
Nhưng điều này có thể giúp gì cho vấn đề này? –
@MichellBak Không, giới hạn này vẫn tồn tại trong ICS. –