2

我正在玩 Mono Droid 并尝试实现以下布局

在此处输入图像描述

我会使用什么类型的布局?Android 中是否有诸如锚点和停靠之类的东西,例如 WinForms,所以这可以有点独立?

这仅适用于平板电脑,更适合我的实验。左侧面板内的按钮将重复。

谢谢。

4

2 回答 2

1

根布局将如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="false"
    android:orientation="horizontal"
    android:padding="5dp" >

    <RelativeLayout
        android:id="@+id/leftContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.8" >
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/rightContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:padding="20dp" >

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:text="btn1" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:text="btn2" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="btn3" />
        </RelativeLayout>
    </RelativeLayout>

</LinearLayout>

在左右布局的顶部添加动态项目作为 ListView。

于 2012-10-24T10:04:41.193 回答
0

线性布局将正常工作..您可以指定要捕获的空间的权重..

于 2012-10-24T10:05:03.063 回答