質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

1454閲覧

android studio button

kimura

総合スコア59

XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2015/08/02 13:18

いつもお世話になります。

android studioで画面の一番下に5列のボタンを作りました。
その上に3列のボタンを作りたいのですが、どのように書けばよろしいのでしょうか?
素人の質問で申し訳ありませんが宜しくお願い致します。

↓現在書いたソースです

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="bottom">

<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/hello_world" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/hello_world" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/hello_world" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/hello_world" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/hello_world" />
</LinearLayout>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

置く物の位置関係をイメージしてレイアウトは組む必要があります.今回の場合は
0. 一番外側に枠組みとなるLinearLayoutを置く.垂直方向(vertical)・下寄せ.
0. Buttonを列ごとに配置するLinearLayoutを2つ置く.水平方向(horizontal).
0. それぞれのLinearLayoutにButtonを置く.
コードのイメージとしては

xml

1<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 android:layout_width="match_parent" 3 android:layout_height="match_parent" 4 android:orientation="vertical" 5 android:gravity="bottom"> 6 7 <LinearLayout 8 android:layout_width="match_parent" 9 android:layout_height="wrap_content" 10 android:orientation="horizontal"> 11 12 <!-- ここにButton配置 --> 13 </LinearLayout> 14 <LinearLayout 15 android:layout_width="match_parent" 16 android:layout_height="wrap_content" 17 android:orientation="horizontal"> 18 19 <!-- ここにButton配置 --> 20 </LinearLayout> 21</LinearLayout>

投稿2015/08/02 13:27

swordone

総合スコア20651

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kimura

2015/08/02 13:42

できました。 分かりやすく教えていただきありがとうございました
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問