ListView控件不再调用setSelection后的onclick反应() [英] ListView no longer reacts to onclick after a call to setSelection()

查看:205
本文介绍了ListView控件不再调用setSelection后的onclick反应()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Zwitscher 我有一个的ListView 的显示许多鸣叫。然后,用户可以重新加载的时间线,如果有新的鸣叫,新的列表加载到列表适配器(加上一些旧的),我通过

In Zwitscher I have a ListView that displays a number of tweets. The user can then reload the timeline and if there are new tweets, the new list is loaded into the list adapter (plus some old ones) and I scroll to the end of the list via

listView.setSelection(x); 

其中, X 是刚装的人最古老的鸣叫的次数。这工作得很好。 但不幸的是这种禁用的 onItemClick() onItemLongClick()的视图处理程序。如果我再(例如,从一个按钮)调用

where x is the number of the oldest tweets of the freshly loaded ones. This works very well. But unfortunately this "disables" the onItemClick() and onItemLongClick() handlers on the view. If I then (e.g. from a button) call

listView.setSelection(0);

的处理程序 onItemClick() onItemLongClick()是启用了。

我已经验证了处理程序仍设置在ListView控件调用 setSelection(X)之后。和禁用的呼吁 setSelection(X)也没有禁止的处理程序。

I've verified that the handlers are still set on the listView after the call to setSelection(x). And disabling that call to setSelection(x) also does not "disable" the handlers.

知不知道我做错了吗?

完整的源代码是在这里:的https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/TweetListActivity.java和有问题的线路都在 onPostExecute()在线417

The full source is here: https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/TweetListActivity.java and the lines in question are in onPostExecute() on line 417

推荐答案

我无法重现。 onItemClick()终止后的任何一个名为 setSelection 。通过创建一个测试案例,再现隔离问题了。如果你成功了,我的事情你应该提交bug到Android。

I could not reproduce that. onItemClick() is called after any setSelection. Try to isolate the problem down by creating a test case that reproduces. If you succeed, I thing you should submit a bug to android.

这篇关于ListView控件不再调用setSelection后的onclick反应()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆