与ListView页脚关联的点击事件有时需要很长时间才能触发,尤其是在进行了大量滚动之后。常规列表项单击始终立即触发。更奇怪的是,当页脚点击仍在等待处理时点击常规项目时,它会立即触发,完成后页脚点击将立即执行(点击按错误的顺序执行)。
任何反馈都非常感谢。
private void init()
{
...
// I attach a footer to this ListActivity instance like so...
LayoutInflater inflater = ((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE));
mFooterView = inflater.inflate(R.layout.row_feed_footer, null, false);
// Add click handler to footer
mFooterView.findViewById(R.id.feed_footer_layout).setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
onFooterClick(v);
}
});
getListView().addFooterView(mFooterView);
// Register with my custom adapter
setListAdapter(mFeedData);
}
private void onFooterClick(View footerView)
{
// After extensive scrolling, this event will take a long time to fire (as long as 5 seconds).
// Unless onListItemClick, in which case it will fire immediately after
}
@Override
protected void onListItemClick(ListView l, View v, int position, long reportSeqNo)
{
// After extensive scrolling, this event will still fire immediately
}
答案 0 :(得分:0)
万一有人遇到类似的问题,我从来没有找到解决方案。这似乎是一个错误。我的解决方法是在我的ListAdapter实现中简单地将页脚实现为特殊情况项。