多くの人に見て貰える様にランキングへのご協力をお願いします!
ゲーム制作 ブログランキングへ
次に紹介するには説明画面のレイアウトファイル。
時際のプログラムであるJavaファイルは2-2で別途説明します。
用途は操作や言葉がわからない時に確認する、良くあるHelp画面ですね。
MainActivity(1-1を参照)の「説明」ボタンを押すと表示されます。
作りは非常に簡単なもので、説明用にサブタイトルの「ScrollView」と
説明文を表示する為のボタンとして「Button」を縦に並べるだけです。
後は「ScrollView」で全体を囲う事で画面からはみ出しても、
スクロールする事で全てを表示可能にしていますね。
画像ファイルである「frame」は黄色枠のフレームでテキスト表示の際に利用。
画像ファイルである「frame2」は赤枠でボタンの際に利用しています。
一番最後の「終了」ボタンだけは固定なので「@string/end_button」を使い、
レイアウト側で中に文字を表示させています。
ただ、2種類の表示方法があると面倒という場合は、その他の文字列と同じく
Javaファイルで全て表示させても良いかと思います。
■help.xml
補足)
@string/end_button = 終了
■イビル・スレイヤー
https://play.google.com/store/apps/details?id=com.hidefumi.kasahara.evel_slayer
■完成画面
ゲーム制作 ブログランキングへ
次に紹介するには説明画面のレイアウトファイル。
時際のプログラムであるJavaファイルは2-2で別途説明します。
用途は操作や言葉がわからない時に確認する、良くあるHelp画面ですね。
MainActivity(1-1を参照)の「説明」ボタンを押すと表示されます。
作りは非常に簡単なもので、説明用にサブタイトルの「ScrollView」と
説明文を表示する為のボタンとして「Button」を縦に並べるだけです。
後は「ScrollView」で全体を囲う事で画面からはみ出しても、
スクロールする事で全てを表示可能にしていますね。
画像ファイルである「frame」は黄色枠のフレームでテキスト表示の際に利用。
画像ファイルである「frame2」は赤枠でボタンの際に利用しています。
一番最後の「終了」ボタンだけは固定なので「@string/end_button」を使い、
レイアウト側で中に文字を表示させています。
ただ、2種類の表示方法があると面倒という場合は、その他の文字列と同じく
Javaファイルで全て表示させても良いかと思います。
■help.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
android:orientation="vertical" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/frame"
android:gravity="center"
android:textSize="25sp"
android:textStyle="italic" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick1"
android:textSize="30sp" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick2"
android:textSize="30sp" />
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick3"
android:textSize="30sp" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/frame"
android:gravity="center"
android:textSize="30sp"
android:textStyle="italic" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick4"
android:textSize="30sp" />
<Button
android:id="@+id/button5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick5"
android:textSize="30sp" />
<Button
android:id="@+id/button6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick6"
android:textSize="30sp" />
<Button
android:id="@+id/button7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick7"
android:textSize="30sp" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/frame"
android:gravity="center"
android:textSize="30sp"
android:textStyle="italic" />
<Button
android:id="@+id/button8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick8"
android:textSize="30sp" />
<Button
android:id="@+id/button9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick9"
android:textSize="30sp" />
<Button
android:id="@+id/button10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick10"
android:textSize="30sp" />
<Button
android:id="@+id/button0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame2"
android:onClick="onClick0"
android:text="@string/end_button"
android:textColor="#990000"
android:textSize="30sp" />
</LinearLayout>
</ScrollView>
補足)
@string/end_button = 終了
■イビル・スレイヤー
https://play.google.com/store/apps/details?id=com.hidefumi.kasahara.evel_slayer
■完成画面
コメント