【发布时间】:2013-05-28 00:27:22
【问题描述】:
我在一个活动中有两个expandableListView,起初,我把它们放在一个LinearLayout中,但是当第一个expandableListView展开太多项目时,我看不到第二个:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >
<ExpandableListView
android:id="@+id/myContactELV"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>
<ExpandableListView
android:id="@+id/myGroupELV"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>
</LinearLayout>
第一个视图包括组 aaa、bbb、ccc,第二个视图包括 ddd、eee:
当第一个展开时,第二个是看不见的,屏幕不滚动:
所以我想把它们放在一个滚动视图中,但更糟糕的是:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ExpandableListView
android:id="@+id/myContactELV"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>
<ExpandableListView
android:id="@+id/myGroupELV"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>
</LinearLayout>
</ScrollView>
所以,当两个 expandableListview 展开时,我想清楚地看到每个项目,并且屏幕滚动。我怎样才能做到这一点?
【问题讨论】:
-
描述使用两个ELV的原因。
-
两个ELV应该有不同的数据源、适配器和不同的含义。这里的数据是为了简单起见,它们不是真实的。
-
你的意思是什么不同的意思?
-
至少回答该死的问题@MaciejGórski
标签: android scrollview expandablelistview