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:orientation="horizontal">

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <EditText
                android:id="@+id/editText1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:inputType="textUri" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/button_as"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="As" />

        </TableRow>

</TableLayout>

私は何を間違っていますか?

4

1 に答える 1

1

現在、列全体の幅は、後続のボタンの幅によって定義されます。これは、その Button が列の中で最も幅が広いためです。

要素内でTableLayout、最初の列 (インデックス 0) を伸縮可能としてマークするには、 を宣言しandroid:stretchColumnsます。

<TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    android:stretchColumns="0">
于 2012-09-16T22:42:59.530 に答える