我有一个 ListView 内 HorizontalScrollView _myListAdapter.notifyDataSetChanged(); 并且数据在数据库中变得可见 . 但是如果 列表视图 视图 列表视图 notifyDataSetChanged 没有作出决定 滚动到当前视图?
ListView
HorizontalScrollView
_myListAdapter.notifyDataSetChanged();
列表视图
视图
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>
我会在你打电话之前让你的ListView不可见 notifyDataSetChanged()
notifyDataSetChanged()
<ListView android:id="@+id/my_list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:visibility="gone"/>
_myListAdapter.notifyDataSetChanged(); ListView listView = (ListView) findViewById(R.id.my_list); listView.setVisibility(View.VISIBLE);
不确定这是否有效。。。不过值得一试。