<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">
<TextView
android:id="@+id/center"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_200"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"></TextView>
<TextView
android:id="@+id/box1"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_700"
app:layout_constraintBottom_toTopOf="@id/center"
app:layout_constraintRight_toRightOf="@+id/center"></TextView>
<TextView
android:id="@+id/box2"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_500"
app:layout_constraintBottom_toTopOf="@id/center"
app:layout_constraintRight_toLeftOf="@+id/center"></TextView>
<TextView
android:id="@+id/box3"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_500"
app:layout_constraintBottom_toTopOf="@id/center"
app:layout_constraintLeft_toRightOf="@+id/center"></TextView>
<TextView
android:id="@+id/box4"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_700"
app:layout_constraintRight_toLeftOf="@id/center"
app:layout_constraintTop_toBottomOf="@id/box2"></TextView>
<TextView
android:id="@+id/box5"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_700"
app:layout_constraintLeft_toRightOf="@id/center"
app:layout_constraintTop_toBottomOf="@id/box2"></TextView>
<TextView
android:id="@+id/box6"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_500"
app:layout_constraintLeft_toRightOf="@id/center"
app:layout_constraintTop_toBottomOf="@id/center"></TextView>
<TextView
android:id="@+id/box7"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_500"
app:layout_constraintRight_toLeftOf="@id/center"
app:layout_constraintTop_toBottomOf="@id/center"></TextView>
<TextView
android:id="@+id/box8"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/purple_700"
app:layout_constraintLeft_toRightOf="@id/box7"
app:layout_constraintTop_toBottomOf="@id/center"></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text1"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/purple_700"
app:layout_constraintBottom_toTopOf="@id/text4"
app:layout_constraintEnd_toStartOf="@id/text2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></TextView>
<TextView
android:id="@+id/text2"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/purple_500"
app:layout_constraintBottom_toTopOf="@id/text5"
app:layout_constraintEnd_toStartOf="@id/text3"
app:layout_constraintStart_toEndOf="@id/text1"
app:layout_constraintTop_toTopOf="parent"></TextView>
<TextView
android:id="@+id/text3"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/purple_200"
app:layout_constraintBottom_toTopOf="@id/text6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/text2"
app:layout_constraintTop_toTopOf="parent"></TextView>
<TextView
android:id="@+id/text4"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/purple_200"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/text5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/text1"></TextView>
<TextView
android:id="@+id/text5"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/text6"
app:layout_constraintStart_toEndOf="@id/text4"
app:layout_constraintTop_toBottomOf="@id/text2"></TextView>
<TextView
android:id="@+id/text6"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/purple_700"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/text5"
app:layout_constraintTop_toBottomOf="@id/text3"></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
'# 1. Language > 🔰 Kotlin' 카테고리의 다른 글
Kotlin # Activity / ViewControl (0) | 2022.07.18 |
---|---|
XML # Shape Drawable 요소 정리 (0) | 2022.07.14 |
Kotlin # LinearLayout/RelativeLayout 실습 (0) | 2022.07.11 |
Kotlin # ConstraintLayout (0) | 2022.07.08 |
Kotlin # LinearLayout/RelativeLayout/Margin&Padding (0) | 2022.07.06 |