728x90
반응형
layout을 살펴보자
헬로월드 따위 지워버리면 요래된다
화면을 기준으로 직접적으로 배치를 할 수도 있다.
css로 치면 앱솔루트 속성과 유사하다.
하지만 가장 흔하게 쓰는 것은 리니어레이아웃이다. 이해하기도 쉽다.
안의 내용을 가로로 배치할지 세로로 배치할지 설정할수 있다.
리니어 레이아웃은 css의 리레이티브와 유사하다.
속성이 vertical과 horizontal 이 있다
리니어 레이아웃 내부에 배치될 오브젝트들의 배치이다.
이렇게 리니어 레이아웃 안에 리니어레이아웃을 배치할 수도 있다.
위 xml 코드는 이거다
<?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"
android:background="#2196F3"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/a"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent"
android:background="#C9DC0F"
android:orientation="horizontal"
tools:ignore="MissingConstraints">
<LinearLayout
android:id="@+id/b"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#7A3333"
android:orientation="vertical"
tools:ignore="MissingConstraints">
</LinearLayout>
<LinearLayout
android:id="@+id/c"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#3F51B5"
android:orientation="vertical"
tools:ignore="MissingConstraints">
</LinearLayout>
</LinearLayout>
리니어레이아웃안에 버튼도 넣고 글씨도 넣고하면서 app의 화면을 꾸며보자
728x90
반응형
'교육 > ANDROID' 카테고리의 다른 글
[안드로이드 스튜디오] 로그캣 : LOG를 찍어보자 (16) | 2022.11.03 |
---|---|
[안드로이드 스튜디오] 기본 기능 사용 권한 얻기 (15) | 2022.11.02 |
[안드로이드스튜디오] 기본 구성 (10) | 2022.10.24 |
[안드로이드 스튜디오] 설치 (15) | 2022.10.23 |