Skip to content Skip to sidebar Skip to footer

Adding ListView Children To A HorizontalScrollView

i have a HorizontalScrollView, and i am adding a bunch of ListView as its children. my XML file looks something like the following. for brevity, i will omit some of the attributes.

Solution 1:

If you are looking to implement horizontal paging see the ViewPager widget in the compatibility library: http://developer.android.com/sdk/compatibility-library.html It works all the way back to devices running Android 1.6. It also allows you to only keep a few pages "live" at any given time, keeping your view hierarchy much simpler and allowing you to work with large data sets.


Solution 2:

You may omit HorizontalScrollView as ListView automatically expand and if there is no room it Scroll automatically. Simply use

    <LinearLayout>
    <ListView android:id="@+id/listView1"/>
    </LinearLayout>

Solution 3:

I'm not sure if this will help, but it might

<HorizontalScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
 <LinearLayout>
  <ListView android:id="@+id/listView1" android:layout_width="fill_parent" android:layout_height="fill_parent"/>
 </LinearLayout>
</HorizontalScrollView>

Post a Comment for "Adding ListView Children To A HorizontalScrollView"