-
특이한 UI 구성 소개안드로이드/학습&강좌 2011. 6. 11. 22:18
이번에 소개할 UI는 안드로이드 사이드에서 소개된 적이 있는 Rotation_project라 보면 된다.
Flipper 로 이벤트가 처리 되어 있어서 약간 부자연 스러운 느낌이 있는데, 갤러리 같은 형식으로 바꿔 보려 했으나 패스...
나름대로 그냥 버튼을 이미지로 대체 했을뿐이다.
대략적인 동작 화면을 보자면
아래의 플래시 화면과 같이 작동 할 것이다.
이런식의 UI구성의 xml이 상당히 특이 한데
각 View마다의 화면을 미리 만들어 놓았던데... 대단하다 노가다의 진수이다. 머리가 지끈거리는게 느껴질 정도이다.
xml을 설명 하자면
xml만 해도 라인이 이정도이니...
main.xml<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:background="#b3b3b3">
<ViewFlipper
android:id = "@+id/V_FLIPPER"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
>
<!-- 1번뷰 시작 -->
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical">
<LinearLayout
android:id = "@+id/V_L01_01"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_01_01"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f1"
/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L01_02"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_01_02"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f2"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L01_03"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.2"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_01_03"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f3"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.6"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L01_04"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_01_04"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f4"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L01_05"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_01_05"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f5"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
</LinearLayout>
<!-- 1번뷰 끝 -->
<!-- 2번뷰 시작 -->
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical">
<LinearLayout
android:id = "@+id/V_L02_01"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_02_01"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f6"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L02_02"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_02_02"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f1"
/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L02_03"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.2"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_02_03"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f2"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.6"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L02_04"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_02_04"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f3"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L02_05"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_02_05"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f4"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
</LinearLayout>
<!-- 2번뷰 끝 -->
<!-- 3번뷰 시작 -->
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical">
<LinearLayout
android:id = "@+id/V_L03_01"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_03_01"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f5"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L03_02"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_03_02"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f6"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L03_03"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.2"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_03_03"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f1"
/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.6"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L03_04"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_03_04"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f2"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L03_05"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_03_05"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f3"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
</LinearLayout>
<!-- 3번뷰 끝 -->
<!-- 4번뷰 시작 -->
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical">
<LinearLayout
android:id = "@+id/V_L04_01"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_04_01"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f4"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L04_02"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_04_02"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f5"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L04_03"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.2"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_04_03"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f6"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.6"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L04_04"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_04_04"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f1"
/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L04_05"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_04_05"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f2"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
</LinearLayout>
<!-- 4번뷰 끝 -->
<!-- 5번뷰 시작 -->
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical">
<LinearLayout
android:id = "@+id/V_L05_01"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_05_01"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f3"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L05_02"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_05_02"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f4"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L05_03"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.2"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_05_03"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f5"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.6"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L05_04"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_05_04"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f6"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L05_05"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_05_05"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f1"
/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
</LinearLayout>
<!-- 5번뷰 끝 -->
<!-- 6번뷰 시작 -->
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:orientation = "vertical">
<LinearLayout
android:id = "@+id/V_L06_01"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_06_01"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f2"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L06_02"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_06_02"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f3"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L06_03"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.2"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_06_03"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f4"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.6"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L06_04"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.9"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_06_04"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f5"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "1.9"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:id = "@+id/V_L06_05"
android:layout_width = "fill_parent"
android:layout_height = "0dip"
android:layout_weight = "1"
android:orientation = "horizontal">
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "0.3"
android:layout_height = "fill_parent"/>
<Button
android:id = "@+id/BTN_06_05"
android:layout_width = "0dip"
android:layout_weight = "1"
android:layout_height = "fill_parent"
android:background="@drawable/f6"/>
<LinearLayout
android:layout_width = "0dip"
android:layout_weight = "2.5"
android:layout_height = "fill_parent"/>
</LinearLayout>
</LinearLayout>
<!-- 6번뷰 끝 -->
</ViewFlipper>
</LinearLayout>
코드를 분석해 보면 이 레이아웃이 어떻게 쓰이는지 알게 될 것이니 참고 하기 바란다. 자세한 설명은 생략 한다.
'안드로이드 > 학습&강좌' 카테고리의 다른 글
세로 프로그래스바(Vertical SeekBar) (45) 2011.07.30 미디어 스캐닝을 통한 Mp3 / 동영상 파일 재생 하기 (3) 2011.06.28 Android Sliding Drawer Tutorial(슬라이드 바) (1) 2011.06.15 C2DM 사용 하기 (1) (3) 2011.06.13 C2DM 서비스 사용을 위한 준비 (2) 2011.06.12 갤러리를 이용한 커버플로우 만들기 (1) 2011.06.11 DrawArc 를 이용한 원그리기 (0) 2011.06.06 asset 을 이용한 txt 문서 읽기. (0) 2011.05.28 간단한 XML 파싱방법 (18) 2011.05.28 TextWatcher 를 이용한 글입력 제한 하기. (0) 2011.05.22 댓글