与 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
}