I would like to use two ListViewson the same screen vertically one below the other, and also two ListViewequally occupy 50% -50% of the screen. My problem is that I created a layout, the eclipse(graphic layout) looks great, but on the device it does not take up half the screen. It seems to depend on the content ListView. How can I do it right?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f0f0"
android:weightSum="1.0">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:textSize="18sp"
android:textStyle="bold"
android:gravity="left"
android:textColor="#000"
android:text="Some Text" />
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="0.5"
android:background="#FB0"
android:scrollbars="none"
android:dividerHeight="2dip" />
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="0.5"
android:background="#FB0"
android:scrollbars="none"
android:dividerHeight="2dip" />
</LinearLayout>
source
share