LinearLayout布局

来源:互联网 发布:网络用语:且是什么意思 编辑:程序博客网 时间:2024/04/27 18:27

LinearLayout布局

LinearLayout布局
这里要特别注意orientation的值

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="0dp"        android:layout_weight="1"        android:orientation="horizontal">        <TextView            android:layout_width="0dp"            android:layout_height="match_parent"            android:layout_weight="1"            android:background="#ff0000"           />        <TextView            android:layout_width="wrap_content"            android:layout_height="match_parent"            android:background="#00ff00"            android:layout_weight="1"/>        <TextView            android:layout_width="wrap_content"            android:layout_height="match_parent"            android:background="#0000ff"            android:layout_weight="1"/>        <TextView            android:layout_width="wrap_content"            android:layout_height="match_parent"            android:background="#aaaaaa"            android:layout_weight="1"/>    </LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="0dp"        android:layout_weight="1"        android:orientation="vertical">        <TextView            android:layout_width="match_parent"            android:layout_height="0dp"            android:layout_weight="1"            android:background="#ff0000" />        <TextView            android:layout_width="match_parent"            android:layout_height="0dp"            android:layout_weight="1"            android:background="#00ff00" />        <TextView            android:layout_width="match_parent"            android:layout_height="0dp"            android:layout_weight="1"            android:background="#0000ff" />        <TextView            android:layout_width="match_parent"            android:layout_height="0dp"            android:layout_weight="1"            android:background="#aaaaaa" />    </LinearLayout></LinearLayout>
0 0
原创粉丝点击