arun8
arun8

Reputation: 1211

Why is Horizontal Scrolling is not working when a List View is placed inside a horizontal ScrollView?

I have a simple list view which is placed inside a Horizontal Scroll view so that I can scroll horizontally when the list view content is too long. When I place Text View inside the horizontalScrollView, I could scroll horizontally. But, with list view it doesn't work. Any body had the same issue? Any work around for this?

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

Upvotes: 0

Views: 439

Answers (1)

nKn
nKn

Reputation: 13761

Because ListView is not meant to be put inside any ScrollView. It's considered a bad practice, as ListView itself has a built-in ScrollView and you may use it, so try avoiding at any price a ListView inside a ScrollView.

If necessary, redesign your layout to not need it, as it goes against Android's design.

Upvotes: 1

Related Questions