Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 원스휴먼 먹이
- 원스휴먼 레시피
- 실버 해안 리조트 거주지 탐색
- 실버 해안 리조트
- 원스휴먼 레시피 파밍
- 소모성 재료
- 원스휴먼 요리
- 원스휴먼 스타크롬
- 테슬라 시황
- 원스휴먼 사료
- 거주지 탐색
- 당뇨 소모성 재료 한시적 특례
- 원스휴먼 황금양 구하기
- 소모성 재료 환급
- 원스휴먼 황금양털파밍
- 유광버섯 통조림
- 당뇨 소모성 재료 환급
- 원스휴먼 쿠폰
- 실버 해안 리조트 비밀상자
- 당뇨 소모성 재료 지원
- 당뇨 소모성 재료
- 테슬라 방산진출
- 소모성 재료 건강보험공단
- 원스휴먼 황금양
- 소모성 재료 등록
- 당뇨 소모성 재료 처방전 없이
- 2차 비상계엄
- 테슬라 오늘시황
- 레시피 파밍
- 원스휴먼 동물
Archives
- Today
- Total
0101011001010111
Android 3-2_UI 레이아웃 실습 숙제 본문
728x90
반응형
아래 화면을 만들어보기

UI 레이아웃 구성
- LinearLayout내에 3개의 LinearLayout을 추가하고 각각의 weight를 1로 사용
- Linear Layout
- Button3개를 세로로 배치
- Layout_gravity를 이용해 위치 조정
- Relative Layout
- Layout margin : 10dp
- Button5를 우측 상단에 고정
- Button4를 Button5 왼쪽에 배치, 오른쪽margin20dp
- Button6을 Button4 아래로 배치, 왼쪽margin10dp
- Constraint Layout
- Button7을 레이아웃 중앙에 배치
- Button8을 Button7 오른쪽 같은 높이에 배치, 왼쪽margin20dp
- Button9를 Button7 아래로 배치
해보기
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#EBB096DF"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON1"
android:layout_gravity="left" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON2"
android:layout_gravity="center" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON3"
android:layout_gravity="right" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#00BCD4"
android:layout_margin="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON4"
android:id="@+id/b4"
android:layout_toLeftOf="@id/b5" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON5"
android:id="@+id/b5"
android:layout_alignParentRight="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON6"
android:id="@+id/b6"
android:layout_below="@id/b5" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#FF9800">
<Button
android:id="@+id/b7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button7"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/b8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="button8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/b7"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/b9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/b7" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

완료오
728x90
반응형
'Kotlin > 안드로이드_[입문]앱개발' 카테고리의 다른 글
| Android4-2_ Intent란 ? Explicit Intent와 Implicit Intent (0) | 2023.08.16 |
|---|---|
| Android4-1_ Activity (0) | 2023.08.16 |
| 3-2 Android UI - Layout _Margin / Padding / Gravity (0) | 2023.08.15 |
| 3-2 Android UI - Layout _Constraint Layout_예제풀어보기 (0) | 2023.08.15 |
| 3-2 Android UI - Layout _Constraint Layout(중요도 : 높음!!) (0) | 2023.08.14 |