您的位置:首页 > 其它

layout_weight属性的使用

2015-12-24 15:50 411 查看
<!--
首先按照声明的尺寸进行分配,然后在根据 weight来分配
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="48dip"
android:orientation="horizontal"
android:baselineAligned="false"
android:weightSum="6"
>

<TextView
android:gravity="center"
android:background="#00ff00"
android:layout_weight="1"
android:layout_width="0dip"
android:layout_height="match_parent"
android:text="11111111111111111111" />

<TextView
android:gravity="center"
android:background="#ff0000"
android:layout_weight="2"
android:layout_width="0dip"
android:layout_height="match_parent"
android:text="2"
/>
<TextView
android:gravity="center"
android:background="#0000ff"
android:text="3"
android:layout_weight="3"
android:layout_width="0dip"
android:layout_height="match_parent"
/>
</LinearLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: