전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란...

28
전전전 전전전 UNIT 04 전전 SW 전전전 전전전 전전전

Transcript of 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란...

Page 1: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

전광판 만들기UNIT

04

로봇 SW 콘텐츠 교육원조용수

Page 2: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

2학습 목표

• Layout XML 이란 ?• 기본 XML 속성 • Text View

Page 3: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

3Layout XML 이란 ?

• UI 구성요소를 정의 • View or ViewGroup 으로 구성 • 다양한 Device 상황에 맞춰서 xml 작성 가능

Page 4: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

4액티비티와 뷰

• 클래스 계층 구조

Object

View

ViewGroup

TextView

LinearLayout

Page 5: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

5Layout XML 구조

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

<TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" />

</LinearLayout>

Page 6: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• background– #RGB– #ARGB– #RRGGBB– #AARRGGBB

배경색을 바꾼다6

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 7: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

7실습 1: Layout XML

• Layout XML 확인 • TextView 의 Text 변경 및 확인

Page 8: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

8LinearLayout 기본 XML 속성

• Orientation – Vertical : 포함된 View 를 가로로 배열– Horizontal : 포함된 View 를 세로로 배열

• layout_width and layout_height– match_parent : 화면 전체 설정– Wrap_content : 포함된 View 의 사이즈 로 설정

• Gravity– 내부 View 의 정렬을 설정– android:gravity="center"

Page 9: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• layout_width, layout_height– match_parent– wrap_content– 상수

몸집 크기를 바꾼다9

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 10: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• layout_width, layout_height– match_parent– wrap_content– 상수

몸집 크기를 바꾼다10

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 11: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• layout_width, layout_height– match_parent– wrap_content– 상수

몸집 크기를 바꾼다11

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 12: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• padding– paddingLeft– paddingRight– paddingTop– paddingBottom– padding

내 몸에 빈 공간을 만든다12

자기자신

자식

Page 13: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• padding– paddingLeft– paddingRight– paddingTop– paddingBottom– padding

내 몸에 빈 공간을 만든다13

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:background="#ffff0000" android:paddingLeft="30dp" />

</LinearLayout>

Page 14: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• padding– paddingLeft– paddingRight– paddingTop– paddingBottom– padding

내 몸에 빈 공간을 만든다14

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:background="#ffff0000" android:padding="30dp" />

</LinearLayout>

Page 15: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• gravity– left, right, top, bottom, center– center_horizontal, center_vertical

자식을 어디에 둘까 ?15

자기자신

자식

Page 16: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

• gravity– left, right, top, bottom, center– center_horizontal, center_vertical

자식을 어디에 둘까 ?16

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/hello_world" android:background="#ffff0000" android:gravity="right|bottom" />

</LinearLayout>

Page 17: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

17실습 2: 기본 속성 설정

• Linearlayout 의 기본 설정을 변경

Page 18: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

TextView

Text View 18

Object

View

Page 19: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

19Text View

• Text Attribute– TextSize : Text 의 사이즈 변경 – TextColor : Color 설정

• ARGB 형식으로 설정 : android:textColor="#9933ff22“• 미리 설정된 값 지정 : android:textColor= "@android:color/holo_green_dark "

– TextStyle• Bold• Italic• normal

Page 20: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

20Text View Attribute 변경

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" 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:text="Robot Class" android:textSize = "55dp" android:textStyle="bold" android:textColor="@android:color/holo_green_dark" /></LinearLayout>

Page 21: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

21글자 내용을 지정한다

• text

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 22: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

22글자 크기를 바꾼다

• textSize

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize=“80sp" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 23: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

23글자 색깔을 바꾼다

• textColor– #RGB– #ARGB– #RRGGBB– #AARRGGBB

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize=“80sp" android:textColor="#ff0000ff" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 24: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

24

• textStyle– normal– bold– italic

글자 모양을 바꾼다

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize=“80sp" android:textColor="#ff0000ff" android:textStyle="italic|bold" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 25: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

25한 줄만 쓴다

• singleLine– true– false

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="80sp" android:textColor="#ff0000ff" android:textStyle="italic|bold" android:singleLine="true" android:text="@string/hello_world" android:background="#ffff0000" />

</LinearLayout>

Page 26: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

26실습 3: 기본 설정 변경

• TextView 의 기본 설정을 변경

Page 27: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

27실습 4: 전광판 만들기

Page 28: 전광판 만들기 UNIT 04 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Layout XML 이란 ? 기본 XML 속성 Text View 2.

28Text View Attribute 변경

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_green_light" android:orientation="vertical">

<TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="Robot Class" android:textSize = "55dp" android:textStyle="bold" android:gravity="center" android:textColor="@android:color/black" />

</LinearLayout>