当监听器为空时意味着什么
我读过一些代码,人们使用这样的代码,
view.setOnLongClickListener(null);
这意味着什么以及有什么用处?为什么有人用这个?
和这个一样吗
view.setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View v) {
return true;
}
});
I have read some code that people use something like this
view.setOnLongClickListener(null);
What does it means and for what can be useful ? why someone uses this ?
is that the same as this
view.setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View v) {
return true;
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Null 将删除当前设置为视图侦听器的任何回调。
它绝对与第二个不同,后者为视图分配一个侦听器来控制在视图上长按时会发生的情况。
Null would remove any callbacks that are currently set as the views listener.
It definitely isn't the same as the second one, which assigns a listener to the view to control what will happen when you perform a long click on your view.