我有以下内容。
<linearLayout>
<RelativeLayout>
<!-- Header -->
</RelativeLayout>
<linearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="6">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
</linearLayout>
然而,布局并没有正确地填满整个高度,我希望实现一个线性布局在另一个线性布局下方并占用父容器的1/6空间的效果。
相反,它似乎将权重应用于元素的宽度。
在Android中,假设百分比高度的正确方法是什么?使用Weight很容易实现宽度,但我似乎无法正确地实现高度。
LinearLayout
上指定orientation:vertical
。 - Amokrane Chentir