Android片段XML布局问题

时间:2013-01-27 14:36:16

标签: android xml layout android-fragments fragment

我正在努力实现我认为是一个相当简单的片段布局,但我遇到了一些问题。任何人都可以粗略地建议XML解决方案用于以下布局(我知道现在支持嵌套片段,但如果可能的话我想避免这种情况):

“=============================”
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| ================== | 333333333 |
| 222222222222222222 | 333333333 |
| 222222222222222222 | 333333333 |
“=============================”

1 个答案:

答案 0 :(得分:1)

这确实是一个简单的布局。

这是你在找什么?

enter image description here

代码如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#ff0000" >
        </FrameLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="2"
            android:background="#00ff00" >
        </FrameLayout>
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:background="#0000ff" >
    </FrameLayout>

</LinearLayout>