内部の子ウィジェットの合計値とすることができます
子ウィジェットのlayout_weightと合わせて設定すると
余白部分を含めたレイアウトが可能です
layout_weight属性
たとえば親のViewGroupのweightSumを10とし
子のViewのButton1とButton2のlayout_weightを
それぞれ5と3とするとButton1に5/10が
Button2に3/10が、残りが余白部分の2/10となります
例をxmlソースで示します
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:weightSum="10"> <Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="0px" android:layout_weight="5" android:text="Button1" /> <Button android:id="@+id/button2" android:layout_width="fill_parent" android:layout_height="0px" android:text="Button2" android:layout_weight="3"/> </LinearLayout>自身の大きさの誤差をなくすため
android:layout_height="0px"
を入れることを忘れないでください

スポンサードリンク
【レイアウト カスタマイズの最新記事】