-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObservableScrollView.java
More file actions
40 lines (30 loc) · 1.02 KB
/
ObservableScrollView.java
File metadata and controls
40 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.wxah.customview;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* 监听滑动事件的ScrollView
* Created by 右右 on 2015/5/19.
*/
public class ObservableScrollView extends ScrollView {
private ObservableScrollListener listener;
public ObservableScrollView(Context context) {
super(context);
}
public ObservableScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ObservableScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void setOnScrollListener(ObservableScrollListener listener) {
this.listener = listener;
}
@Override
protected void onScrollChanged(int x, int y, int oldx, int oldy) {
super.onScrollChanged(x, y, oldx, oldy);
if (listener != null) {
listener.onScrollChanged(x, y, oldx, oldy);
}
}
}