目次

LinearlayoutとViewの位置

LinearLayoutで並べたViewを均等に並べる

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:orientation="vertical"
        android:background="@color/head"
        >

        <androidx.appcompat.widget.AppCompatTextView
            android:layout_width="match_parent"
            android:layout_height="0dp"  // ←高さは0dpにする
            android:layout_weight="1"    // ←1対1の場合
            android:text="ああああ"/>

        <androidx.appcompat.widget.AppCompatTextView
            android:layout_width="match_parent"
            android:layout_height="0dp"  // ←高さは0dpにする
            android:layout_weight="1"  // ←1対1の場合
            android:text="ああああ"/>

    </LinearLayout>

FrameLayoutでViewを中心に置く

        <com.google.android.material.circularreveal.CircularRevealFrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/result"
                android:layout_width="70dp"
                android:layout_height="70dp"
                android:layout_gravity="center_vertical|center_horizontal" // layout_gravityを設定する。
                />

TextViewの文字の位置を中止にする

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/quest"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textSize="20sp"
                android:gravity="center" // ただのgravityはViewの内側の位置の設定ができる
                android:background="@drawable/radius"/>