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.
精彩评论