public class CustomViewTwo extends LinearLayout {
private static final String TAG = "CustomView";
public CustomViewTwo(Context context) {
super(context);
}
public CustomViewTwo(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomViewTwo(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
boolean intercepted = false;
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
Log.d(TAG, "CustomViewTwo onInterceptTouchEvent: ACTION_DOWN");
break;
case MotionEvent.ACTION_MOVE:
Log.d(TAG, "CustomViewTwo onInterceptTouchEvent: ACTION_MOVE");
break;
case MotionEvent.ACTION_UP:
Log.d(TAG, "CustomViewTwo onInterceptTouchEvent: ACTION_UP");
break;
}
return intercepted;
}
public boolean onTouchEvent(MotionEvent event) {
boolean intercepted = false;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
Log.d(TAG, "CustomViewTwo onTouchEvent: ACTION_DOWN");
break;
case MotionEvent.ACTION_MOVE:
Log.d(TAG, "CustomViewTwo onTouchEvent: ACTION_MOVE");
break;
case MotionEvent.ACTION_UP:
Log.d(TAG, "CustomViewTwo onTouchEvent: ACTION_UP");
break;
}
return intercepted;
}
}
近期评论