Download presentation
Presentation is loading. Please wait.
1
UNIT 05 신문 만들기 로봇 SW 콘텐츠 연구원 조용수
2
학습 목표 Linear Layout 활용 XML Widget 배치
3
Linear Layout 활용 Android 기본 Layout Orientation Padding Margin
Gravity and Layout_gravity Visibility Invisibility gone
4
리니어 레이아웃 뷰 뷰 뷰 … Object 뷰 View 뷰 ViewGroup 뷰 LinearLayout …
5
배열하는 방향 orientation horizontal vertical
<LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:background="#ff00ff00" /> </LinearLayout>
6
배열하는 방향 orientation horizontal vertical
<LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:background="#ff00ff00" /> </LinearLayout>
7
내 몸에 빈 공간을 만든다 paddingLeft paddingRight paddingTop paddingBottom
자기자신 자식
8
내 몸 밖에 빈 공간을 만든다 layout_marginLeft layout_marginRight layout_marginTop
layout_marginBottom layout_margin 부모 자기자신
9
내 몸 밖에 빈 공간을 만든다 <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_marginLeft="30dp" android:background="#ff00ff00" /> </LinearLayout>
10
내 몸 밖에 빈 공간을 만든다 <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_margin="30dp" android:background="#ff00ff00" /> </LinearLayout>
11
자식을 어디에 둘까? gravity left, right, top, bottom, center
center_horizontal, center_vertical 자기자신 자식
12
나를 어디에 둘까? layout_gravity left, right, top, bottom, center
center_horizontal, center_vertical 부모 자기자신
13
나를 어디에 둘까? layout_gravity left, right, top, bottom, center
center_horizontal, center_vertical <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_gravity="right" android:background="#ff00ff00" /> </LinearLayout>
14
나를 어디에 둘까? layout_gravity left, right, top, bottom, center
center_horizontal, center_vertical <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_gravity="bottom" android:background="#ff00ff00" /> </LinearLayout>
15
나를 어디에 둘까? layout_gravity left, right, top, bottom, center
center_horizontal, center_vertical <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_gravity="bottom" android:background="#ff00ff00" /> </LinearLayout>
16
감추거나 사라지거나 visibility visible invisible gone
<LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="invisible" android:background="#ffff0000" /> android:layout_gravity="top" android:background="#ff00ff00" /> </LinearLayout>
17
감추거나 사라지거나 visibility visible invisible gone
<LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:background="#ffff0000" /> android:layout_gravity="top" android:background="#ff00ff00" /> </LinearLayout>
18
도전
19
실습 1: Layout 생성
20
크기를 비율에 따라 <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_weight="1" android:background="#ff00ff00" /> android:layout_weight="0" android:background="#ff0000ff" /> </LinearLayout>
21
크기를 비율에 따라 <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffff0000" /> android:layout_weight="1" android:background="#ff00ff00" /> android:layout_weight="2" android:background="#ff0000ff" /> </LinearLayout>
22
미션
Similar presentations