0

私は TablLayout を持っています。それは 1 行と 2 列です。

最初の列はテキストです。できるだけ大きくしたいのですが、2 番目の列は 2 行 1 列の別のテーブルです。

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

<TableLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="1"

    >
<TableRow>
    <TextView
            android:id="@+id/parkingDataText"
            android:layout_marginLeft="10dip"
            android:layout_marginRight="10dip" 
            />
    <TableLayout>
        <TableRow>
            <ImageButton
                android:id="@+id/buttonStar"
                android:layout_marginLeft="10dip"
                android:background="@null" 
                />
        </TableRow>
        <TableRow>
            <ImageButton
                android:id="@+id/buttonRent" 
                android:layout_marginLeft="10dip"
                android:background="@null" 
                />
        </TableRow>
    </TableLayout>

</TableRow>

strechColumns="1" を使用する必要があると思ったのですが、最初の列は 2 番目の列が使用しないスペースを占有していましたが、機能しません。何か案が?

前もって感謝します

4

1 に答える 1

0

要件に合わせて以下のレイアウトを試してください。

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="2">
<TableRow>
   <TextView
            android:layout_column="1"
            android:text="Save As..."
            android:padding="3dip"
            android:layout_width="200dp" />
        <TableLayout 
    android:layout_column="2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:stretchColumns="2">

    <TableRow>
        <TextView
            android:layout_column="1"
            android:text="Textview column1"
            android:padding="3dip" />

    </TableRow>
        <TableRow>
        <TextView
            android:layout_column="1"
            android:text="Textview column2"
            android:padding="3dip" />

    </TableRow>
    </TableLayout> 
    </TableRow>

</TableLayout>
于 2012-05-17T05:36:19.023 に答える