开发者

Android ListView OnItemClickListener Vs. View OnClickListener

Why does an OnClickListener for a View inside a ListView not respond to a trackball click on the view, while an OnItemClickListener for the ListView does respond to a trackball c开发者_运维知识库lick on one of the ListView's views?


That is by design.

The ListView component is specifically built to trigger those events in that way. I believe they are actually defined in AdapterView abstract class. Other AdapterView descendants (Gallery, Spinner, etc.) will also behave the same way.

There is also an ONItemLongClick as well.

View.OnClick is only used by controls with simple semantics, e.g. Button where there is only one "kind" of click.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜