Android fragment XML 布局问题

标签 android xml layout android-fragments fragment

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

"============================="
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| 111111111111111111 | 333333333 |
| ================== | 333333333 |
| 222222222222222222 | 333333333 |
| 222222222222222222 | 333333333 |
"============================="

最佳答案

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

这是您要找的吗?

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>

关于Android fragment XML 布局问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14548427/

相关文章:

android布局从屏幕推送 View

css - "Unspecified width fixed"+ 流体布局

android - 如何查找具有特定标签(属性)的 View 列表

java - 特定索引的 Hashmap 替换数组列表

python - 从 XML 文档创建 DataFrame

python - python lxml 中的 XQuery 绝对路径

xml - 验证 XML/识别中断点的快速方法

android - 带有图标和文本的按钮

java.io.IOException : Connection reset by peer 异常

android - 如何修改 android 源代码并将其用于 Android 设备?