Mat*_*ska 6 android horizontalscrollview android-listview
我想用卡片创建一种卡片布局,其中包含一个可以水平滚动卡片的ListView布局HorizontalScrollableView.一切正常,但我有滚动问题.只有当我没有水平滚动卡片时才能垂直滚动列表视图而反之亦然.
这是主要的容器:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<HorizontalScrollView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ddd" >
<LinearLayout
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我膨胀并将listview项添加到线性布局.我想平滑地进行垂直和水平滚动,没有这些限制(同时水平和垂直滚动).
我怎样才能做到这一点?
我建议将您的水平布局作为您在适配器的 getView() 中返回的根视图。这样,每一行将彼此分开滚动。如果这不能立即起作用,您可能必须为行设置 setItemsCanFocus(true) 才能将输入提供给水平滚动视图。