标签: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