多くの人に見て貰える様にランキングへのご協力をお願いします!
ゲーム制作 ブログランキングへ
まずはアプリの顔であるスタート画面のソースから公開して行きます。
「openning」という画像ファイル(剣とタイトル)を背景に設定し、
ボタンを横に2個×2段の配置を行っています。
(「frame3」がボタンに利用している画像)
実際にボタンを押した際の処理は別途Javaファイルに記載される為、
こちらは本当にレイアウトだけの内容となりますね。
(Javaファイルは1-2として別途公開します)
■MainActivity(レイアウトファイル)
</LinearLayout>
補足)
@string/start_button = 開始
@string/help_button = 説明
@string/Library_button = 図鑑
@string/Delete_button = 消去
■完成画面
ゲーム制作 ブログランキングへ
まずはアプリの顔であるスタート画面のソースから公開して行きます。
「openning」という画像ファイル(剣とタイトル)を背景に設定し、
ボタンを横に2個×2段の配置を行っています。
(「frame3」がボタンに利用している画像)
実際にボタンを押した際の処理は別途Javaファイルに記載される為、
こちらは本当にレイアウトだけの内容となりますね。
(Javaファイルは1-2として別途公開します)
■MainActivity(レイアウトファイル)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/openning"
android:gravity="bottom|center|clip_vertical"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/frame3"
android:onClick="onClick1"
android:layout_weight="1"
android:text="@string/start_button"
android:textColor="#990000"
android:textSize="25sp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/frame3"
android:onClick="onClick2"
android:layout_weight="1"
android:text="@string/help_button"
android:textColor="#990000"
android:textSize="25sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/frame3"
android:onClick="onClick3"
android:text="@string/Library_button"
android:textColor="#990000"
android:textSize="25sp" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame3"
android:onClick="onClick4"
android:layout_weight="1"
android:text="@string/Delete_button"
android:textColor="#990000"
android:textSize="25sp" />
</LinearLayout>
補足)
@string/start_button = 開始
@string/help_button = 説明
@string/Library_button = 図鑑
@string/Delete_button = 消去
■完成画面
コメント