티스토리 뷰
In LinearLayout
1. weight와 weightSum
<LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:background="#ffffffff">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="#ff000000"/>
</LinearLayout>
1) 비율을 정확히 고정시키고 싶을 때는
자체 테이블을 그리거나 할 때 TableLayout을 사용하면 알아서 늘어나고 줄어드는 컬럼 때문에 정신건강에 좋지 않다. 이럴 때는 LinearLayout을 이용해서 android:layout_width를 0px로 변경하고, weight로 비율을 고정하면 늘어나고 줄어들지 않게 고정시킬 수 있다. 정확히 나뉜 컬럼이 필요하거나 할 때는 이 방법을 이용한다. 단, 이렇게 나뉘는 영역에는 당연하겠지만 margin이 포함되지 않으니 margin을 함부로 사용하면 어그러진다. padding을 잘 활용해야 한다.
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="0.25"
'study > Android' 카테고리의 다른 글
[Android] Android Studio에서 NDK 프로젝트 적용 시 오류사항 정리 (0) | 2015.11.12 |
---|---|
[Android] Dialog (0) | 2014.01.13 |
[Android] 안드로이드 인터넷 상태 체크 및 확인 (1) | 2013.12.29 |
[Android] intent가 중복 실행될 때 (0) | 2013.12.28 |
[Android] Animation 정리 (0) | 2013.12.28 |