我在我的應用程序中設置了一個計時器,我可以從Web服務獲取一些信息並導致顯示列表視圖。現在我的問題是,每次計時器運行時,回滾到開始...在列表視圖中保持滾動位置
我該如何保持滾動位置與列表視圖中的每個刷新?我的代碼
部分:
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(DashboardActivity.this,
all_chat,
R.layout.list_item,
new String[] { TAG_FULLNAME,
TAG_DATE,
TAG_MESSAGE },
new int[] { R.id.fullname,
R.id.date,
R.id.message }
);
// updating listview
setListAdapter(adapter);
}
});
TNX。
http://stackoverflow.com/a/3035521/931982 – stinepike
可能重複[維護/保存/恢復滾動位置時返回到ListView](http://stackoverflow.com/questions/3014089/maintain-save -restore-scroll-position-when-returning-to-listview) – stinepike
這些鏈接並不能解決我的問題,因爲我的問題是另一回事。我的列表視圖自動從Web服務接收數據,然後將位置移回到開始位置(頂部位置)....,我希望你解決我的問題...... tnx。 –