アンドロイド開発で画面のボタン配置方法についてです。
画面最下部にボタンを4つ配置して、2つを左端に、2つを右端にボタンを配置したいのですが、どのようにコードを書けばわかりません。layoutやweightなどを使いして試したのですがどうも上手くいきませんでした。おそらくとても簡単だと思うのですが、よろしくお願いします。
xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/sun" android:layout_marginLeft="150dp" android:id="@+id/img"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center_horizontal|bottom"> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="btn1" android:textSize="12dp" android:id="@+id/btn1"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12dp" android:text="btn2" android:id="@+id/btn2"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12dp" android:text="btn3" android:id="@+id/btn3"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12dp" android:text="btn4" android:id="@+id/btn4"/> </LinearLayout> </FrameLayout>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/24 02:16 編集