onClickListener和onItemClickListener区别 [英] difference between onClickListener and onItemClickListener

查看:195
本文介绍了onClickListener和onItemClickListener区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是在Android的列表视图onClickListener和onItemClickListener之间的区别?
什么是这些不同的实现?

what is the difference between onClickListener and onItemClickListener in Android ListViews ? And what are the different implementations of these ?

推荐答案

ListView控件对列表视图中的每一行一个项目单击监听器,但onClickListener是整个列表视图无论哪个永远排点击的onClick onItemClickListener 的叫,但附带每种方法的值是不同的。

ListView has an Item Click listener for each row of the listview but the onClickListener is for the whole listview no matter which ever row you click the onClick and onItemClickListener is called but the values that come with each method are different.

<一个href=\"http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html\">OnItemClickListener您可以使用让说要当一个特定的行被触及特定活动。

OnItemClickListener you can use for lets say going to a particular activity when a particular row is touched.

<一个href=\"http://developer.android.com/reference/android/view/View.OnClickListener.html\">OnClickListener你可以检查列表视图已被用户这样做要刷新列表收到了联系?或者改变滚动条的视图或做一些与ListView控件作为一个整体单位。

OnClickListener you can check if the listview has received a touch by the user so do you want to refresh the list? or change the scrollbar's view or do something with the listview as a whole unit.

这篇关于onClickListener和onItemClickListener区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆