【问题标题】:Android fill percent of layoutAndroid填充布局百分比
【发布时间】:2015-11-11 14:32:49
【问题描述】:

如何使布局中的元素占据 50%、25%、10% 等可用的水平/垂直空间?

【问题讨论】:

    标签: android layout


    【解决方案1】:

    你可以用类似的东西来实现这一点:(这里是垂直的)

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

    android:weightsum documentation

    【讨论】:

      猜你喜欢
      • 2011-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-02
      • 1970-01-01
      • 1970-01-01
      • 2017-04-16
      • 1970-01-01
      相关资源
      最近更新 更多