0

等間隔で等サイズの 3 つのボタンが必要です。いずれかのボタンのテキストが 3 語 (改行) を超える場合、図に示すようにボタンが下にドロップします。3つのボタンすべてが同じ行にある場所を同じように修正する方法はありますか? TableLayout/を使用してみましたRowが、役に立ちませんでした。

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/linearLayout1"
    android:layout_alignParentBottom="true" android:layout_width="fill_parent"
    android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
            <Button android:text="Trade"
                android:layout_weight="1" android:layout_height="wrap_content"
                 android:layout_width="0dip" ></Button>
            <Button android:text="Set Alert"![enter image description here][2]                  
                android:layout_weight="1" android:layout_height="wrap_content"
                android:layout_width="0dip" ></Button>
            <Button android:text="Add to watchlist"                 
                android:layout_weight="1" android:layout_height="wrap_content"
                android:layout_width="0dip"></Button>

</LinearLayout>

ここに画像の説明を入力

4

2 に答える 2

0

私はそれを試しましたが、上記のレイアウトを取得し、3つのボタンで android:layout_height を「fill_parent」に設定するとうまくいきます。

(これは興味深い問題ですが、最後のボタンが少しずれている理由はわかりません。)

于 2011-07-21T10:01:51.857 に答える
-1

ボタンの線を特定の量より小さく/大きくしたくない場合は、次のことを試してください。

Button b = null;
b.setMaxLines(1);
b.setMinLines(1);

アップデート:

b.setSingleLine();

于 2011-07-21T01:35:29.537 に答える