日々是好日~every day is a good day~

日常の中の非日常の備忘録

【Android Studio】ブロックくずし 2回目

今日は『メイン画面のレイアウト(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"
    tools:context=".MainActivity"
    android:orientation="vertical">
    <TextView
        android:id="@+id/tvScore"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="Score : 0"
        android:textSize="18sp"
        android:paddingLeft="10dp"
        android:gravity="center_vertical"/>
    <FrameLayout
        android:id="@+id/frame"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        android:background="#090909">
        <ImageView
            android:id="@+id/ball"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_gravity="center|center"
            android:src="@drawable/ball" />
        <TextView
            android:id="@+id/startLabel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center|center"
            android:layout_marginTop="110dp"
            android:paddingLeft="10dp"
            android:text="タップしてスタート"
            android:textColor="#FDFCFC"
            android:textSize="24sp" />
        <ImageView
            android:id="@+id/bar"
            android:layout_width="50dp"
            android:layout_height="15dp"
            android:layout_gravity="center|bottom"
            android:layout_marginBottom="10dp"
            android:src="@drawable/bar" />
        <com.example.brockbraking.BlockView
            android:id="@+id/blockView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </FrameLayout>
</LinearLayout>


ゲーム画面のレイアウトができました
ブロックはBlockViewというViewを継承したクラスで表示します