-4

2つ以上のボタンを横向きに設定する方法などは、すべて縦型の順になっています。xmlでコーディングを教えてください。

4

1 に答える 1

1

それらをlinearlayoutに配置し、向きを水平に設定する必要があります

 <LinearLayout 
       android:id="@+id/login_selectionButtonGroup"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:orientation="horizontal">
                <Button
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_gravity="center_horizontal"
                    android:text="Button 1"
                    android:layout_weight="1">
                </Button>
                <Button
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_gravity="center_horizontal"
                    android:text="Button 2"
                    android:layout_weight="1">
                </Button>
        </LinearLayout>

お役に立てれば

于 2013-01-28T14:49:07.040 に答える