Search code examples
androidlistviewandroid-studiohorizontal-scrollinghorizontalscrollview

Android HorizontalScrollView appearing as Vertical


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.


Solution

  • 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?