-3

以下は私のレイアウトxmlコードです:

        <LinearLayout
            android:id="@+id/c"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <RelativeLayout
                android:id="@+id/a"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:orientation="vertical" >
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/b"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:orientation="vertical" >
            </RelativeLayout>
        </LinearLayout>

LinearLayout c に 2 つの RelativeLayout a と b があります。
a と b は高さが異なる場合があります。
同じ高さの 2 つの RelativeLayout を最も高いものにしたいと考えています。
どうすれば実装できますか?

4

5 に答える 5

1

テーブルレイアウトを使用して自動調整します

<TableLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="fill_parent"
       android:layout_height="match_parent"
       android:padding="5dp"
       android:shrinkColumns="1"
       android:stretchColumns="1" >

       <TableRow android:id="@+id/tableRow1" >

           <TextView
               android:id="@+id/textView1"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="Main Status             "
               android:textAppearance="?android:attr/textAppearanceMedium" />

           <Button
               android:id="@+id/retentionMainStatus"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="CLICK ME" />
</TableRow>
</TableLayout>
于 2013-06-25T06:34:05.670 に答える
1

それを試してみてください

<LinearLayout
        android:id="@+id/c"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:weightSum="2" >

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

    <RelativeLayout
        android:id="@+id/b"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >
    </RelativeLayout>
    </LinearLayout>

その助けを願っています

于 2013-04-10T07:12:34.133 に答える