我有一个非常复杂的视图构建,作为其中的一部分,我在 ScrollView 内的 LinearLayout 中有一个 ListView(以及更多的组件,但它们在这个问题中并不重要)。
现在整个活动可以正常滚动,但是 ListView 的高度有限,当其中的项目超过高度时,我的屏幕就会消失。我试图将 ListView 放在它自己的 ScrollView 中,但这不起作用。当我尝试在 ListView 上滚动时,主 ScrollView 被选中并且我的屏幕滚动而不是 ListView。
我的问题可能听起来很简单,但我无法解决这个问题......是否可以让 ListView 也可滚动?
相关的 XML:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:id="@+id/GlobalLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView android:id="@+id/EndpointList"
android:choiceMode="multipleChoice"
android:layout_height="175dip"
android:layout_width="fill_parent" />
</LinearLayout>
</ScrollView>