我想用getLastVisiblePosition(),显然它不是此方法(notifyDataSetChanged)被调用后给我正确的号码。我觉得这个方法只通知认为,有变化,但变化后触发。
I want to use getLastVisiblePosition() and apparently it is not giving me the right number after this method (notifyDataSetChanged) has been called. I think this method only notifies the view that there is a change, but the change is triggered later.
在视图更新时,是没有办法,我可以使用,引发我的方法,使用getLastVisiblePosition事件?
When the view is updated, is there an event that I can use and trigger my method, using getLastVisiblePosition?
请帮助或告诉我什么,我做错了;)
Please help or tell me what I am doing wrong ;)
谢谢 Danail
推荐答案
是的,如果你运行 notifyDatasetChanged()
,你需要排队的后因为视图是异步呈现:
Yes, if you run notifyDatasetChanged()
, you need to queue the operation in the post
because the view is rendered asynchronously:
listView.post(new Runnable() {
public void run(){
lastPos = listView.getLastVisiblePosition();
}
});
相关推荐
最新文章