【发布时间】:2009-12-10 04:23:58
【问题描述】:
我在HorizontalScrollView 中有一个ListView,它工作得非常好,除了初始加载。我正在从 Web 服务加载列表视图的数据,因此我创建了一个线程来执行此操作。获得数据后,我只需调用_myListAdapter.notifyDataSetChanged();,数据就会在ListView 中可见。但是如果ListView 远离屏幕,包含HorizontalScrollView 将自动滚动以使ListView 可见。如何在不使ListView 滚动到当前视图的情况下调用notifyDataSetChanged?
以下是我如何拥有布局 XML 文件的想法:
<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>
【问题讨论】:
-
不适合我...列表垂直显示
标签: android listview horizontalscrollview