I have an ListView
inside a HorizontalScrollView
and it works perfectly fine, except for the initial load. I'm loading the data for the list view from a web service so I created a thread to do that. Once I have the data, I simply call _myListAdapter.notifyDataSetChanged();
and the data becomes visible in the ListView
. But if the ListView
is far off the screen, the containing HorizontalScrollView
will automatically scroll to make this ListView
visible. How can I call notifyDataSetChanged
without making the ListView
scroll into the current view?
Here's an idea of how I have my layout XML file:
<HorizontalScrollView
android:id="@+id/my_scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none">
<LinearLayout android:id="@+id/my_layout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ListView android:id="@+id/my_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
</HorizontalScrollView>