2

Hi I want to create a horizontal scrollview but it comes out as vertical. Can you help?

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ListView
            android:id="@+id/household_member_list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
</HorizontalScrollView>

Here is what appears:

enter image description here

Please help. Thanks.

Shubhamhackz
  • 7,333
  • 7
  • 50
  • 71

2 Answers2

2

You are using ListView inside of ScrollView, this will not work.

If you want to have horizontal ListView you need to use RecyclerView

More here: Horizontal ListView in Android?

Jakub Gabčo
  • 257
  • 2
  • 14
0

You can use recyclerview. Set horizontal linear layout as layoutmanager for recyclerview to achieve horizontal scrolling

prashant17
  • 1,520
  • 3
  • 14
  • 23