3

TextViewとToggleButtonをテーブルの行に配置しようとしていますが、整列していないようです(各要素の高さが同じであっても、ボタンの上部はテキストビューの上部から約10px下から始まります。誰か教えてもらえますか?

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

        >
    <TableRow>
        <AutoCompleteTextView
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:layout_weight="1"
        />

        <ToggleButton
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        />
        </TableRow>

        </TableLayout>
4

1 に答える 1

2

TableRowはLinearLayoutのように動作し、デフォルトでウィジェットをベースラインに沿ってテキストに揃えようとします。別の位置に配置する場合は、ToggleButtonを設定android:layout_gravity="center_vertical"(またはその他の重力設定)します。

于 2010-05-16T22:04:45.980 に答える