码迷,mamicode.com
首页 > 其他好文 > 详细

RecyclerView.addOnScrollListener

时间:2019-08-04 19:37:27      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:null   自定义   report   clear   repo   add   sed   ons   HERE   

/**
* Set a listener that will be notified of any changes in scroll state or position.
*
* @param listener Listener to set or null to clear
*
* @deprecated Use {@link #addOnScrollListener(OnScrollListener)} and
* {@link #removeOnScrollListener(OnScrollListener)}
*/
@Deprecated
public void setOnScrollListener(OnScrollListener listener) {
mScrollListener = listener;
}
public void addOnScrollListener(OnScrollListener listener) {
if (mScrollListeners == null) {
mScrollListeners = new ArrayList<>(http://www.my516.com);
}
mScrollListeners.add(listener);
}
public void removeOnScrollListener(OnScrollListener listener) {
if (mScrollListeners != null) {
mScrollListeners.remove(listener);
}
}
使用setOnScrollListener()方法时,注解会提示此方法即将被废弃的方法:
Inspection info: Reports where deprecated code is used in the specified inspection scope.

所以,我们采用addOnScrollListener()方法将我们自定义的OnScrollListener类添加进去。
--------------------- 

RecyclerView.addOnScrollListener

标签:null   自定义   report   clear   repo   add   sed   ons   HERE   

原文地址:https://www.cnblogs.com/liyanyan665/p/11299166.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!