简体   繁体   中英

Android ListView OnItemClickListener Vs. View OnClickListener

为什么ListView内的View的OnClickListener没有响应视图上的轨迹球点击,而ListView的OnItemClickListener确实响应了ListView视图之一的轨迹球点击?

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, eg Button where there is only one "kind" of click.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM