• AndroidTouchEvent总结


    默认状态

    布局文件

    <?xml version="1.0" encoding="utf-8"?>
    <com.malinkang.touchsample.widget.MyFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ff0000"
        android:orientation="vertical">
    
        <com.malinkang.touchsample.widget.MyLinearLayout
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:background="#00ff00"
            android:layout_gravity="center"
            android:gravity="center">
    
            <com.malinkang.touchsample.widget.MyTextView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="#0000ff" />
        </com.malinkang.touchsample.widget.MyLinearLayout>
    
    </com.malinkang.touchsample.widget.MyFrameLayout>
    /**
     * Created by malinkang on 15/8/24.
     */
    public class TouchEventActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.touch_event);
        }
    
        @Override
        public boolean dispatchTouchEvent(MotionEvent ev) {
            Log.d("TouchEventActivity","dispatchTouchEvent方法执行"+super.dispatchTouchEvent(ev)+":"+Utils.getNameForEvent(ev));
            return super.dispatchTouchEvent(ev);
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            Log.d("TouchEventActivity", "onTouchEvent执行" +super.onTouchEvent(event)+":"+ Utils.getNameForEvent(event));
            return super.onTouchEvent(event);
        }
    
    
    }
    /**
     * Created by malinkang on 15/8/25.
     */
    public class MyFrameLayout extends FrameLayout {
        public MyFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
        public MyFrameLayout(Context context) {
            super(context);
        }
    
        public MyFrameLayout(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            Log.d("MyFrameLayout", "onInterceptTouchEvent方法执行" + super.onInterceptTouchEvent(ev) + ":" + Utils.getNameForEvent(ev));
            return super.onInterceptTouchEvent(ev);
        }
    
        @Override
        public boolean dispatchTouchEvent(MotionEvent ev) {
            Log.d("MyFrameLayout", "dispatchTouchEvent方法执行:" + super.dispatchTouchEvent(ev) + ":" + Utils.getNameForEvent(ev));
            return super.dispatchTouchEvent(ev);
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            Log.d("MyFrameLayout", "onTouchEvent执行" + super.onTouchEvent(event) + ":" + Utils.getNameForEvent(event));
            return super.onTouchEvent(event);
        }
    }
    /**
     * Created by malinkang on 15/8/24.
     */
    public class MyLinearLayout extends LinearLayout {
        public MyLinearLayout(Context context) {
            super(context);
        }
    
        public MyLinearLayout(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public MyLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            Log.d("MyLinearLayout","onInterceptTouchEvent方法执行"+ super.onInterceptTouchEvent(ev)+":"+Utils.getNameForEvent(ev));
            return super.onInterceptTouchEvent(ev);
        }
    
        @Override
        public boolean dispatchTouchEvent(MotionEvent ev) {
            Log.d("MyLinearLayout","dispatchTouchEvent方法执行:"+super.dispatchTouchEvent(ev)+":"+Utils.getNameForEvent(ev));
            return super.dispatchTouchEvent(ev);
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            Log.d("MyLinearLayout","onTouchEvent执行" +super.onTouchEvent(event)+":"+Utils.getNameForEvent(event));
            return super.onTouchEvent(event);
        }
    }
    /**
     * Created by malinkang on 15/8/24.
     */
    public class MyTextView extends TextView {
        public MyTextView(Context context) {
            super(context);
        }
    
        public MyTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public MyTextView(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            Log.d("MyTextView", "onTouchEvent执行" + super.onTouchEvent(event) + ":" + Utils.getNameForEvent(event));
            return super.onTouchEvent(event);
    
        }
        
        
    
    }

    log

    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.699  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 10:49:48.709  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.709  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.714  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.719  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 10:49:48.744  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 10:49:48.744  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_MOVE
    08-25 10:49:48.744  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 10:49:48.809  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 10:49:48.809  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_MOVE
    08-25 10:49:48.809  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 10:49:48.839  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP
    08-25 10:49:48.839  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_UP
    08-25 10:49:48.839  17390-17390/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP

    TextView的onTouchEvent返回true

    08-25 10:57:56.874  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.874  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.874  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.874  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 10:57:56.874  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行true:ACTION_DOWN
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_CANCEL
    08-25 10:57:56.879  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:false:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_CANCEL
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 10:57:56.884  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_DOWN
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.929  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_MOVE
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_UP
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行false:ACTION_UP
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyTextView﹕ onTouchEvent执行true:ACTION_UP
    08-25 10:57:56.934  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:true:ACTION_UP
    08-25 10:57:56.939  23744-23744/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_UP
    08-25 10:57:56.939  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:false:ACTION_UP
    08-25 10:57:56.939  23744-23744/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_UP
    08-25 10:57:56.939  23744-23744/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP
    08-25 10:57:56.939  23744-23744/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_UP
    08-25 10:57:56.939  23744-23744/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP

    LinearLayout的onInterceptTouchEvent 修改为true

    08-25 11:16:52.144    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 11:16:52.144    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.144    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.149    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onInterceptTouchEvent方法执行false:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ dispatchTouchEvent方法执行:false:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onInterceptTouchEvent方法执行true:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyLinearLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/MyFrameLayout﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.154    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_DOWN
    08-25 11:16:52.169    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.169    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_MOVE
    08-25 11:16:52.169    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.204    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.204    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_MOVE
    08-25 11:16:52.204    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.219    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.224    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_MOVE
    08-25 11:16:52.224    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.234    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.234    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_MOVE
    08-25 11:16:52.234    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_MOVE
    08-25 11:16:52.234    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP
    08-25 11:16:52.234    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行false:ACTION_UP
    08-25 11:16:52.234    5739-5739/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP

    MyFrameLayout的dispatchTouchEvent返回true

    08-25 11:22:56.009    9414-9414/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 11:22:56.009    9414-9414/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行true:ACTION_DOWN
    08-25 11:22:56.009    9414-9414/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_CANCEL
    08-25 11:22:56.014    9414-9414/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_DOWN
    08-25 11:22:56.034    9414-9414/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 11:22:56.034    9414-9414/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行true:ACTION_MOVE
    08-25 11:22:56.034    9414-9414/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_MOVE
    08-25 11:22:56.034    9414-9414/com.malinkang.touchsample D/MyFrameLayout﹕ dispatchTouchEvent方法执行:true:ACTION_UP
    08-25 11:22:56.034    9414-9414/com.malinkang.touchsample D/TouchEventActivity﹕ dispatchTouchEvent方法执行true:ACTION_UP
    08-25 11:22:56.034    9414-9414/com.malinkang.touchsample D/TouchEventActivity﹕ onTouchEvent执行false:ACTION_UP

    http://www.cnblogs.com/sunzn/archive/2013/05/10/3064129.html

  • 相关阅读:
    java提高篇(四)-----抽象类与接口
    hdu1004----用java链表实现
    jkfladsdjfkldsa
    Handler_1
    Handler实现线程间的通信2
    Handler实现线程间的通信1
    Handler基本运行机制
    Android线程
    Activity声明周期2
    Activity声明周期1
  • 原文地址:https://www.cnblogs.com/malinkang/p/4756939.html
Copyright © 2020-2023  润新知