我有一个简单的列表视图放在水平滚动视图中,这样当列表视图内容太长时我可以水平滚动。当我将文本视图放在horizontalScrollView中时,我可以水平滚动。但是,使用列表视图它不起作用。 任何机构都有同样的问题吗?有没有解决这个问题?
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/newListBoxContainerHSV"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:background="#FF00FF">
<ListView
android:id="@+id/list_view"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="#FFFF00"
>
</ListView>
</HorizontalScrollView>
答案 0 :(得分:1)
因为ListView
并不意味着放在任何ScrollView
内。它被视为不良做法,因为ListView
本身有内置ScrollView
,您可以使用它,因此请尽量避免{{1}在ListView
内。
如有必要,请重新设计您的布局,使其不再需要,因为它违反了Android的设计。