Transcript 07-그림책만들기1
UNIT 07 그림책 만들기 1/2 로봇 SW 콘텐츠 연구원 조용수 학습 목표 • Button Widget 활용 – Widget Id 설정 – Resource : R – View 연결 • Layout 제작 2 미션 3 프로젝트 생성 4 프로젝트 생성 5 실습 1: 프로젝트 생성 • 실습용 프로젝트 생성 6 버튼 7 Object View TextView Button 버튼 글자와 배경 • text • background <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:layout_width="200dp" android:layout_height="50dp" android:text="@string/hello_world" android:background="@drawable/big" /> </LinearLayout> 8 버튼 글자와 배경 • text • background <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:layout_width="200dp" android:layout_height="50dp" android:text="@string/hello_world" /> </LinearLayout> 9 나는 ???입니다 10 • id <RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <TextView android:id="@+id/tvTitle" android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> R.java 11 뷰 찾기 • findViewById 12 실습 1: 버튼 연결 • LinearLayout • Button 2개와 TextView 추가 • Java 소스와 연결 13 Layout 제작 14 • 필요한 Widget – – – – ImageView Button : 이전 TextView : Page 표시 Button : 다음 Layout 제작 : Resource 추가 • 필요한 Resource 를 복사 15 Layout 제작 : Resource 추가 • 필요한 Resource 를 복사 16 Layout 분석 17 • Vertical ImageView Button TextView Button • Horizontal Layout 분석 18 • Vertical ImageView Button TextView Button • Horizontal 실습 19 실습 <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"> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/imageView" android:src="@drawable/p01" android:layout_gravity="center_horizontal" /> 20 실습 <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="New Text" android:id="@+id/textView"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button2"/> </LinearLayout> </LinearLayout> 21