布局Android的填充百分比 [英] Android fill percent of layout

查看:80
本文介绍了布局Android的填充百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在一个布局元素占据了50,25,10,水平/垂直方向的可用空间等百分比?

How do I make elements in a layout occupy 50, 25, 10, etc. percent of the horizontal/vertical space available?

推荐答案

您可以用类似的东西做到这一点:(垂直位置)

You could achieve this with something like that : ( for vertical here )

<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>`

请参阅<一href="http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android%3aweightSum">android:weightsum文档

这篇关于布局Android的填充百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆