public class MyScrollView extends ScrollView{
private OnScrollListener listener = null;
public MyScrollView(Context context) {
super(context);
}
public MyScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MyScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setOnScrollListener(OnScrollListener listener){
this.listener = listener;
}
public interface OnScrollListener{
public void onScrolled();
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
// TODO Auto-generated method stub
super.onScrollChanged(l, t, oldl, oldt);
if(listener != null){
listener.onScrolled();
}
}
}
监听ScrollView的滚动
最新推荐文章于 2021-05-31 15:57:12 发布