[英]Android: Linearlayout vertical: Why cannot evenly distributed vertically
在我的xml中
<LinearLayout
android:id="@+id/row2B"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/row2A"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/row2A"
android:orientation="vertical"
android:padding="@dimen/dp10"
android:paddingBottom="2dp"
android:splitMotionEvents="false"
android:weightSum="6" >
<ImageButton
android:id="@+id/btn_amend_all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/transparent_btn"
android:scaleType="center"
android:splitMotionEvents="false" />
<ImageButton
android:id="@+id/btn_amend_list1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp2"
android:layout_weight="1"
android:background="@drawable/white_btn_border_nil"
android:scaleType="center"
android:splitMotionEvents="false"
android:src="@drawable/btn_edit_selector" />
<ImageButton
android:id="@+id/btn_amend_list2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp2"
android:layout_weight="1"
android:background="@drawable/white_btn_border_nil"
android:scaleType="center"
android:splitMotionEvents="false"
android:src="@drawable/btn_edit_selector" />
<ImageButton
android:id="@+id/btn_amend_list3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp2"
android:layout_weight="1"
android:background="@drawable/white_btn_border_nil"
android:scaleType="center"
android:splitMotionEvents="false"
android:src="@drawable/btn_edit_selector" />
<ImageButton
android:id="@+id/btn_amend_list4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp2"
android:layout_weight="1"
android:background="@drawable/white_btn_border_nil"
android:scaleType="center"
android:splitMotionEvents="false"
android:src="@drawable/btn_edit_selector" />
<ImageButton
android:id="@+id/btn_amend_list5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp2"
android:layout_weight="1"
android:background="@drawable/white_btn_border_nil"
android:scaleType="center"
android:splitMotionEvents="false"
android:src="@drawable/btn_edit_selector" />
</LinearLayout>
左侧是row2A内的RadioGroup,代码是row2B,alignTop和row2A的底部。
指的是android中的android:weightSum,它如何工作? ,我希望6个按钮的高度均匀分布,但是为什么上述方法无法达到目的?
提前致谢!
采用
android:layout_height="0dp"
用于所有ImageButton
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.