80 likes | 258 Views
안드로이드. Chap 5 사용자 인터페이스. 양승혁 Yang_ka@kunsan.ac.kr 군산대학교 통계컴퓨터과학과 정보과학기술 연구실 2013.1.16. 목차. 사용자 인터페이스 뷰 기본 위젯 레이아웃. 사용자 인터페이스. ViewGroup. View. View. ViewGroup. View. View. View. 사용자 인터페이스 요소 뷰 (View) 기본적인 사용자 인터페이스 클래스 사용자 인터페이스 , 레이아웃 클래스 파생 뷰 그룹 (View Group)
E N D
안드로이드 Chap 5 사용자 인터페이스 양승혁 Yang_ka@kunsan.ac.kr 군산대학교 통계컴퓨터과학과 정보과학기술 연구실 2013.1.16
목차 • 사용자 인터페이스 • 뷰 • 기본 위젯 • 레이아웃 IST (Information Sciences & Technology) Laboratory
사용자 인터페이스 ViewGroup View View ViewGroup View View View • 사용자 인터페이스 요소 • 뷰(View) • 기본적인사용자 인터페이스 클래스 • 사용자 인터페이스, 레이아웃 클래스 파생 • 뷰 그룹(View Group) • 뷰 클래스의 확장 버전 • 액티비티(Activity) • 사용자가 직접 상호 작용하는 창, 화면 • 다른 플랫폼의 폼에 해당하는 안드로이드의 구성 요소 • 사용자인터페이스를 표시하기 위해 뷰나 레이아웃을 액티비티에 지정 IST (Information Sciences & Technology) Laboratory
기본 위젯 • 기본 위젯 • 표준 도구 상자(Standard View Toolbox)를 통해 제공 • Button • CheckBox • EditText • 편집가능한 텍스트 입력 박스 • ListView • 여러 개의 유사 항목을 목록에 표시하는데 사용되는 뷰를 묶어서 관리하는 뷰 그룹 • RadioButton • 체크 박스가 여러 개 묶인 것과 동일 • TextView • 읽기 전용 텍스트 레이블 IST (Information Sciences & Technology) Laboratory
레이아웃(LAYOUT)(1/3) • 레이아웃(LAYOUT) • 화면 위에 배치되어 있는 컨트롤의 위치를 동적으로 관리 • ViewGroup클래스의 확장 클래스 • FrameLayout • 뷰의 위치를 레이아웃의 좌상단 모서리에 고정 • LinearLayout • 수직, 수평 일직선 상에 배치 • RelativeLayout • 뷰와 레이아웃의 경계를 기준으로 상대적인 배치 • TableLayout • 행과 열을 기준으로 배치 • AbsoluteLayout • 절대 좌표 기준으로 배치 IST (Information Sciences & Technology) Laboratory
레이아웃(LAYOUT) (2/3) <? xml version=“1.0” encoding=“utf-9”?> <LinearLayout xmlns:android:Http://schemas.android.com/apk/res/android” android:orientation=“vertical” android:layout_width=“fill_parent” android:layout_height=“fill_parent” > <Text View android:layout_width=“fill_parent” android:layout_height=“wrap_content” android:text=“Input the text what do you want:” /> <EditText android:layout_width=“fill_parent” android:layout_height=“wrap_content” android:text=“Input the text what do you want:” /> </LinerarLayout> LinearLayoutlo; LinearLayout.LayoutParamsLoTextView; LinearLayout.LayoutParamsLoEditText; TextViewtv; EditText et; lo = new Layout(this); tv = new TextView(this); et = new EditText(this); lo.setOrientation(LinearLayout.VERTICAL); tv.setText(“Input the text what do you want:”); et.setText(“InPut here.”); lo.addView(tv, new LinearLayout.LayoutParams(LinearLayoutParams.FILL_PARENT, LinerarLayoutParams.WRAP_CONTENT)); lo.addView(et, new LinearLayout.LayoutParams(LinearLayoutParams.FILL_PARENT, LinerarLayoutParams.WRAP_CONTENT)); setContentView(lo); • 레이아웃(LAYOUT) 구축 • 외부리소스를 사용하여 XML로 구축하는 방법 • 레이아웃을 담고 있는 XML은 반드시 단일 루트 엘리먼트 • 최상위 노드는 겹쳐진 레이아웃과 뷰를 소유 할 수 있음 IST (Information Sciences & Technology) Laboratory
레이아웃(LAYOUT) (3/3) Main.xml String.xml String.xml IST (Information Sciences & Technology) Laboratory
Thank you Yang_ka@kunsan.ac.kr 군산대학교 정보통계학과 정보과학기술 연구실 2012.01.03 양승혁 Yang_ka@kunsan.ac.kr 군산대학교 통계컴퓨터과학과 정보과학기술 연구실 2013.1.16