开发者

What is the impact of using onClick within each item view vs. onItemClick in ListView?

I wrote a ListView to select a single item from a list. To achieve what I feel is a better separation of concerns in my ListView implementation, I am setting the onClickListener on each row's item view. Is there any functional difference between doing this and using the ListView's onItemClick?

I'm not terribly familiar with non-touchscreen android device interfaces and after watching the Google ListView v开发者_StackOverflow中文版ideo, am wondering if my technique may malfunction on other devices.

Is there any reason not to register onClick on each item's view?


The benefit you get from onItemClick is the paramters passed through function call specially position as a parameter. On OnClick its hard to determine which row has been clicked.

And onClick need to be registered with each row (view/layout) of ListView, while onItemClick need to be registered only once by calling setOnItemClickListener on ListView object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜