android:weightSum 활용

Android 2015. 1. 15. 11:14


가능은 합니다.. parent에 weight_sum을 1로 정하시고, child에 layout_weight 을 .7로 주면.. 70%를 차지하게 됩니다.

부모뷰의 weightSum 값을 기준으로 자식뷰에 할당되는 layout_weight 값에 따라 부모뷰의 영역을 차지한다.


<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>





출처; http://www.androidpub.com/1507297



: