完成イメージ
デザインの一例
レイアウト
サンプルコード
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#222222"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/forest"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#52222222"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="@+id/hpCaption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="4dp"
android:text="HP:"
android:textColor="#FFFFFF"
android:textSize="48sp" />
<TextView
android:id="@+id/hpText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="10"
android:textColor="#FFFFFF"
android:textSize="48sp" />
</LinearLayout>
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:srcCompat="@drawable/slime" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="4dp">
<Button
android:id="@+id/attackButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:backgroundTint="#222222"
android:text="こうげき"
app:strokeColor="#FFFFFF"
app:strokeWidth="1dp" />
<Button
android:id="@+id/itemButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:backgroundTint="#222222"
android:text="もちもの"
app:strokeColor="#FFFFFF"
app:strokeWidth="1dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="4dp">
<Button
android:id="@+id/defenceButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:backgroundTint="#222222"
android:text="ぼうぎょ"
app:strokeColor="#FFFFFF"
app:strokeWidth="1dp" />
<Button
android:id="@+id/escapeButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:backgroundTint="#222222"
android:text="にげる"
app:strokeColor="#FFFFFF"
app:strokeWidth="1dp" />
</LinearLayout>
</LinearLayout>
HPを減らす処理
工事中