0

私はRelativeLayouts自分のアプリに 2 つを使用することにしました。1 つは画面の左側Layoutの子の部分、もう 1 つは子が右側に移動する部分です。ViewsViews

問題は、XML でそれらをレイアウトする方法がわからないため、Layout.

これが私が欲しいものです。

1 を使用するRelativeLayoutと、真ん中の空白が で埋められ、RelativeLayoutその後ろには何も触れられません。

読んでいただきありがとうございます。

4

1 に答える 1

2

次の例と同様のことを行います。

これにより、LinearLayoutwith 2RelativeLayoutsを使用layout_weightしてが作成され、RelativeLayoutsに必要なものを入力できRelativeLayoutsます。

Buttons、例の単なるプレースホルダーです。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="TEST1" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="TEST2" />
    </RelativeLayout>

</LinearLayout>
于 2012-07-31T19:48:36.517 に答える