Android填充布局百分比

Kei*_*ler 13 layout android

如何使布局中的元素占据水平/垂直空间的50%,25%,10%等百分比?

lou*_*uio 15

你可以用这样的东西来实现这个目标:(对于垂直方向)

<LinearLayout 
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:weightSum="100">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="60">
    </LinearLayout>
</LinearLayout>`
Run Code Online (Sandbox Code Playgroud)

请参阅android:weightsum文档