0

画面の下部、レイアウトの他のビュー要素の下に 2 つのボタンを持つ TableRow を配置しようとしていますが、そこに配置すると、TableRow が画面から消えます。上でも真ん中でも問題ありません。

私は多くのlayout_gravity、gravity、weightの組み合わせを試していましたが、それを得ることができません.

レイアウトのスクリーンショット

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

<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:gravity="center_horizontal" 
    android:text="@string/traza" 
    android:layout_margin="10sp"/>

    <TableRow
        android:id="@+id/tableRow8"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="3sp"
        android:gravity="center"
        android:weightSum="2" >

        <Button
            android:id="@+id/reiniciar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_margin="5sp"
            android:background="@drawable/bordebutton"
            android:text="@string/reiniciar" />

        <Button
            android:id="@+id/comprobar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_margin="5sp"
            android:background="@drawable/bordebutton"
            android:text="@string/comprobar" />

    </TableRow>

<android.gesture.GestureOverlayView
    android:id="@+id/gestures"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:fadeEnabled="true"
    android:fadeOffset="3000"
    android:gestureStrokeType="multiple"
    android:eventsInterceptionEnabled="true"
    android:orientation="vertical"/>
</LinearLayout>
4

2 に答える 2

2

これを実現するには、 RelativeLayoutを使用する必要があります。

どうぞ:

<?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"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10sp"
        android:gravity="center_horizontal"
        android:text="@string/traza"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TableRow
        android:id="@+id/tableRow8"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="3sp"
        android:gravity="center"
        android:weightSum="2"
        android:layout_alignParentBottom="true" >

        <Button
            android:id="@+id/reiniciar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5sp"
            android:layout_weight="1"
            android:background="@drawable/bordebutton"
            android:text="@string/reiniciar" />

        <Button
            android:id="@+id/comprobar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5sp"
            android:layout_weight="1"
            android:background="@drawable/bordebutton"
            android:text="@string/comprobar" />
    </TableRow>

    <android.gesture.GestureOverlayView
        android:id="@+id/gestures"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:eventsInterceptionEnabled="true"
        android:fadeEnabled="true"
        android:fadeOffset="3000"
        android:gestureStrokeType="multiple"
        android:orientation="vertical" />

</RelativeLayout>
于 2012-04-20T19:26:19.620 に答える
0

編集:TableLayoutに含まれる機能を使用する場合 、ルート要素は である必要がありますView。あなたは現在それを として持っていますLinearLayout

非ビューがドキュメントTableRowに垂直に配置される方法について言及しているものはありません。

私の経験から、 aTableLayoutは常に最後の行のすぐ下に配置します。

を使用しRelativeLayoutたり、必要なことを達成したりLinearLayoutしましたか? よりもはるかに柔軟ですTableLayout

を閉じて、その下にTableLayout配置することもできますLinearLayout

于 2012-04-20T19:24:31.580 に答える