Android 具有两个列表视图的布局权重

Android 具有两个列表视图的布局权重,android,android-linearlayout,android-layout-weight,Android,Android Linearlayout,Android Layout Weight,我想要两组垂直的列表视图。 我希望它们分别是垂直屏幕长度的40%和60% 代码如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="1">

我想要两组垂直的列表视图。
我希望它们分别是垂直屏幕长度的40%和60%

代码如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
  android:layout_weight="0.4" 
  android:layout_width="match_parent"
  android:layout_height="0dp">
    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />
</LinearLayout>
<LinearLayout
    android:layout_weight="0.6"
    android:layout_width="match_parent"
    android:layout_height="0dp">

     <ExpandableListView
        android:id="@+id/listEvents"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         />
</LinearLayout>
</LinearLayout>

但这不起作用。
第一个ListView占据整个屏幕

我还尝试删除嵌入两个ListView的LinearLayout,但也没有成功。 我还尝试在两个列表视图中使用android:layout\u height=“wrap\u content”,但都没有成功

如果我将屏幕旋转到横向,然后再回到端口,它就会工作。
它无法创建第一个实例

有没有办法解决这个问题?

这个布局可以:

<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
     >
     <ListView
         android:id="@+id/lvwView"
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_weight="0.4"
     />
     <ExpandableListView
        android:id="@+id/elvEvents"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.6"
    />
</LinearLayout>

只是不要继承
ListActivity
ListFragment
中的