1

次のレイアウトを作成したいと思います。これは、縦向きで表示するときに横向きで 100% 表示する必要があります。

代替テキスト http://www.freeimagehosting.net/uploads/b12bb68569.png

ここに私が試したが動作しない私のコードがあります

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:stretchColumns="0">

<TableRow>
    <TableLayout android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <TableRow>
            <TableLayout android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:orientation="horizontal">
                <TableRow>
                    <TextView android:id="@+id/reviewItemEntityName"
                        android:layout_height="wrap_content" android:text="12345"
                        android:textColor="@color/maroon" />

                    <ImageView android:id="@+id/reviewItemStarRating"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:src="@drawable/title_1_star" />
                </TableRow>
            </TableLayout>



        </TableRow>

        <TableRow>

            <TextView android:id="@+id/reviewItemDescription"
                android:layout_width="0dip" android:layout_height="wrap_content"
                android:text="Description comes here" android:textSize="12sp" />
        </TableRow>

    </TableLayout>
    <ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:src="@drawable/arrow_nxt"
        android:layout_gravity="center_vertical"
        android:layout_alignParentRight="true" />
    </TableRow>
</TableLayout>
4

1 に答える 1

2

これはあなたが探しているものだと思います。「android:layout_weight」値で遊ぶことを忘れないでください。基本的に、ウィジェットにどれだけ拡張する必要があるかを伝えます(利用可能な空きスペースを使用します)。

楽しんで。

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    >

<TableRow android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
    <TableLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1">      
        <TableRow>
            <TextView android:text="TextView Up Left" 
                android:id="@+id/TextView01" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:gravity="left"
                android:layout_weight="1">
            </TextView>
            <ImageView android:id="@+id/ImageView01" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:src="@android:drawable/btn_plus"
                android:gravity="right">
            </ImageView>
        </TableRow>
        <TableRow>
        <TextView android:text="Text view with padding" 
            android:id="@+id/TextView02" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:paddingBottom="20.0dp" 
            android:paddingLeft="20.0dp" 
            android:paddingRight="20.0dp" 
            android:paddingTop="20.0dp"
            android:layout_weight="1">
        </TextView>
        </TableRow>
    </TableLayout>
    <TableLayout android:id="@+id/TableLayout01" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:layout_weight="0">
        <TableRow android:layout_width="fill_parent" 
            android:layout_height="fill_parent"
            android:layout_weight="1">
        <ImageView android:id="@+id/ImageView02" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_minus"
            android:layout_gravity="center"
            >
        </ImageView>
        </TableRow>
    </TableLayout>
</TableRow>
</TableLayout>
于 2010-02-03T12:25:57.393 に答える