도전 01 문제
1. 제약 레이아웃을 사용해 화면을 구성합니다.
2. 화면의 아래쪽에 가이드라인을 배치합니다.
3. 가이드라인의 위쪽에 버튼을 추가한 후 가이드라인과 연결합니다. 그리고 적절한 간격으로 띄워줍니다.
4. 가이드라인의 위쪽에 버튼을 하나 더 추가한 후 이전에 추가했던 버튼 및 가이드라인과 연결합니다. 그리고 적절하게 띄워줍니다.
01. 프로젝트
<?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" tools:context=".MainActivity"> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layout_constraintGuide_begin="650dp" /> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="100dp" android:layout_marginBottom="108dp" android:text="버튼1" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="36dp" android:layout_marginBottom="112dp" android:text="버튼2" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/button" /> </androidx.constraintlayout.widget.ConstraintLayout>
도전 02 문제
1. 제약 레이아웃을 사용해 화면을 구성합니다.
2. 화면의 위쪽에 버튼을 추가하고 가로 방향으로 꽉 차도록 만듭니다.
3. 화면의 아래쪽에 버튼을 추가하고 가로 방향으로 꽉 차도록 만듭니다.
4. 화면의 가운데에 버튼을 추가하고 위쪽 버튼과 아래쪽 버튼 사이의 중앙 공간을 꽉 채우도록 만듭니다.
02. 프로젝트
<?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" tools:context=".MainActivity"> <Button android:id="@+id/button" android:layout_width="0dp" android:layout_height="wrap_content" android:text="버튼1" android:textSize="20sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <Button android:id="@+id/button2" android:layout_width="0dp" android:layout_height="600dp" android:layout_marginTop="16dp" android:text="버튼2" android:textSize="20sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/button" /> <Button android:id="@+id/button3" android:layout_width="0dp" android:layout_height="wrap_content" android:text="버튼3" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/button2" app:layout_constraintVertical_bias="0.542" /> </androidx.constraintlayout.widget.ConstraintLayout>
'JAVA' 카테고리의 다른 글
[Android/Java] Do it 도전 04 문제 (0) | 2023.12.10 |
---|---|
[Android/Java] Do it 도전 03 문제 (0) | 2023.12.08 |
[백준/Java] 2083번 - 럭비 클럽 (0) | 2023.09.14 |
Java 기초 용어 (1) | 2023.09.14 |