今日は、ボタン配置を実行してみます。まずは、前回作成したソースと前回の記事の構成マップを使い説明します。
main.xmlファイルを開いて以下の赤字を追加して下さい。
如何でしょうか?ボタンがでました。
main.xmlファイルを開いて以下の赤字を追加して下さい。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:text="button"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
▷ボタンで実行してみて下さい。android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:text="button"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
如何でしょうか?ボタンがでました。
0 件のコメント:
コメントを投稿