Android: strange weight inversion in LinearLayout -
this xml layout i'm working on:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff" android:orientation="vertical" > <scrollview android:layout_weight="2" android:id="@+id/scrollconfirm" android:layout_width="fill_parent" android:layout_height="fill_parent"> </scrollview> <linearlayout android:layout_margintop="20px" android:layout_weight="1" android:id="@+id/imagenumpad" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:src="@drawable/myicon" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="#ffffff" /> </linearlayout> </linearlayout> since have setted scrollview layout_weight="2" , linearlayout (child) layout_weight="1" expected scrollview use twice free space linearlayout. obtain opposite result. scrollview smaller linearlayout. whereas if set scrollview layout_weight="1" , linearlayout layout_weight="2", scrollview greater linearlayou.
how possible??
weight inverse because using match_parent layout_height. weight used distribute remaining empty space or take away space when total sum larger linearlayout. set heights 0dip work.
i.e., set layout_height = "0dip" both scrollview , inner linearlayout.
reference :
Comments
Post a Comment