Layout은 LinearLayout
orientation을 통하여 vertical인지 horizontal 인지 정함
layout_gravity를 통하여 왼쪽 중간 오른쪽 나눔
분할을 위해서는 weight를 이용하여 분할을 한다.
렐러티브레이아웃(상대적 레이아웃)
상대적 레이아웃 | Android 개발자 | Android Developers
버튼에 색을 주는 경우 기존 Button이 아닌 android.widget.Button을 사용해야한다.
EditText에서 흰트를 위하여는 Hint를 사용하면 된다.
match_parent는 부모를 꽉 채우는 것이며, wrap_content는 내용에 따라서 크기를 변동하는 것이다.
모바일 프로그래밍 과제
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ff0000">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#11FF00">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#038AFF">
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FFEB65">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#6AFAFF">
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#878787">
</LinearLayout>
</LinearLayout>
</LinearLayout>
'학교수업' 카테고리의 다른 글
컴퓨터그래픽스 5주차 (0) | 2022.10.05 |
---|---|
컴퓨터 그래픽스 4주차 (0) | 2022.09.28 |
데이터베이스 4주차 (0) | 2022.09.27 |
컴퓨터그래픽스응용 3주차 (0) | 2022.09.21 |
데이터베이스 3주차 (0) | 2022.09.20 |