lmw
2024-07-19 cd13751df41c6504b3934cd3f1bd441c4ba172ff
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
package com.dollearn.student.views;
 
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;
 
public class MyMapView extends FrameLayout {
 
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
 
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            getParent().requestDisallowInterceptTouchEvent(true);//拦截父类事件
 
        } else if (ev.getAction() == MotionEvent.ACTION_UP) {
            getParent().requestDisallowInterceptTouchEvent(false);
        }
 
        return super.dispatchTouchEvent(ev);
    }
 
    public MyMapView(Context context) {
        super(context);
    }
 
    public MyMapView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
 
    public MyMapView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
 
}