Programming/Android
[Android] Framelayout : 중첩배치
By훈트
2011. 3. 14. 15:53
FrameLayout은 자식 뷰들을 겹쳐서 그리고자 할때 사용하는 레이아웃이다.
여러이미지들을 같은영역에 겹쳐서 표시하고자 할때 유용하다.
특성이름 | 적용대상 | 설명 | 값 |
android:foreground | 부모 뷰 | 내용위에 겹쳐 그릴 표시물 자원 | 표시물 자원 참조 |
android:foregroundGravity | 부모 뷰 | 전경 표시물의 중력(정렬 방식) | 다음 상수등 중 하나 또는 여러개를 '|'로 결합한것 : top, bottom, left, right, center_vertical, fill_vertical, fill_vertical, center_horizontal, fill_horizontal, center, fill |
android:measureAllChildren | 부모 뷰 | 레이아웃의 크기를 모든 자식을 고려해서 결정할 것인지 아니면 VISIBLE로 설정된 자식들만(INVISIBLE로 설정된 것들은 빼고) 고려할 것인지의 여부 | true/ false |
android:layout_gravity | 자식 뷰 | 부모 안에서 자식 뷰의 중력(정렬방식) | 다음 상수등 중 하나 또는 여러개를 '|'로 결합한것 : top, bottom, left, right, center_vertical, fill_vertical, fill_vertical, center_horizontal, fill_horizontal, center, fill |
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/FrameLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center">
<ImageView
android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/green_rect"
android:minHeight="200px"
android:minWidth="200px"></ImageView>
<ImageView
android:id="@+id/ImageView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/red_oval"
android:minHeight="100px"
android:minWidth="100px"
android:layout_gravity="center" ></ImageView>
</FrameLayout>
<FrameLayout
android:id="@+id/FrameLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center">
<ImageView
android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/green_rect"
android:minHeight="200px"
android:minWidth="200px"></ImageView>
<ImageView
android:id="@+id/ImageView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/red_oval"
android:minHeight="100px"
android:minWidth="100px"
android:layout_gravity="center" ></ImageView>
</FrameLayout>