Android 布局中的“权重”属性(<;包括>;标签
我正在尝试使用Android 布局中的“权重”属性(<;包括>;标签,android,Android,我正在尝试使用标记重用android应用程序中的一些布局组件。我有不同的港口和陆地布局: 端口: <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="@layou
标记重用android应用程序中的一些布局组件。我有不同的港口和陆地布局:
<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>
否则——不是
下面是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"/>
当前的限制是,您必须为要应用的其他布局属性指定布局宽度和布局高度。ICS中的“当前”将被更改?但这如何有助于解决此问题?@MichellBak否,此限制在ICS中仍然存在。@se.solovyev它解决了您的问题。。。include标记必须指定要考虑的重量的宽度和高度。
<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>
<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"/>