Android学習/Relativelayout
10211 ワード
RelativeLayout
RelativeLayoutのプロパティ
でも一度は使います!
📎 親コンテナベースのプロパティ

中央揃え

📎特定のビューベースのプロパティ
特定のビューの左側と右側に貼り付ける場合は、次の操作を行います。

特定のビューの上部に貼り付ける場合は

特定のビューの下部に貼り付ける場合は、

サンプルコード2479182
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 빨간색 상자 -->
<TextView
android:id="@+id/view1"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#f23204"
android:layout_centerInParent="true"/>
<!-- 오른쪽 선-->
<TextView
android:id="@+id/view2"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#cddc39"
android:layout_toRightOf="@+id/view1"/>
<!-- 위쪽 선-->
<TextView
android:id="@+id/view3"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#cddc39"
android:layout_above="@+id/view1"/>
<!-- 아래쪽 선-->
<TextView
android:id="@+id/view4"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#cddc39"
android:layout_below="@+id/view1"/>
<!-- 왼쪽 선-->
<TextView
android:id="@+id/view5"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#cddc39"
android:layout_toStartOf="@+id/view1"/>
</RelativeLayout>

Reference
この問題について(Android学習/Relativelayout), 我々は、より多くの情報をここで見つけました https://velog.io/@yellowsummer/안드로이드-공부-RelativeLayoutテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol