wxr
2020-06-15 b8e94316e41eba72d927d5ca7d931b26139ee8ff
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using Android.Views;
using Android.Content;
using Android.Util;
using Android.Runtime;
 
namespace Shared
{
    //已经全面检查了代码
    /// <summary>
    /// 绝对布局
    /// </summary>
    public class FrameLayout : ViewGroup
    {
        /// <summary>
        /// 当前视图
        /// </summary>
        public FrameLayout ()
        {
            viewGroup = new AndroidFrameLayout (Application.Activity, this);
            realViewGroup = viewGroup;
        }
        /// <summary>
        /// 以传进来的对象为当前对象
        /// </summary>
        /// <param name="frameLayout">Frame layout.</param>
        internal FrameLayout (Android.Widget.FrameLayout frameLayout)
        {
            viewGroup = frameLayout;
            realViewGroup = viewGroup;
        }
    }
    //已经全面检查了代码
    /// <summary>
    /// Android原生绝对布局视图 FrameLayout
    /// </summary>
    class AndroidFrameLayout : Android.Widget.FrameLayout
    {
        View _view;
        public AndroidFrameLayout(Context context,View view)
            : base(context)
        {
            _view = view;
        }
        public override bool OnTouchEvent(MotionEvent e)
        {
            base.OnTouchEvent(e);
            _view?.TouchEvent(e);
            return true;
        }
        bool disallowIntercept;
        public override void RequestDisallowInterceptTouchEvent(bool disallowIntercept)
        {
            this.disallowIntercept = disallowIntercept;
            //Shared.HDLUtils.WriteLine($"{GetType()} Height->{Height} RequestDisallowInterceptTouchEvent->{disallowIntercept}");
            base.RequestDisallowInterceptTouchEvent(disallowIntercept);
            Parent?.RequestDisallowInterceptTouchEvent(disallowIntercept);
        }
    }
 
    //已经全面检查了代码
    /// <summary>
    ///  已经全面检查代码
    /// </summary>
    class AndroidLinearLayout : Android.Widget.LinearLayout
    {
        View _view;
        public AndroidLinearLayout (Context context, View view)
            : base (context)
        {
            _view = view;
        }
        public override bool OnTouchEvent(MotionEvent e)
        {
            base.OnTouchEvent(e);
            _view?.TouchEvent(e);
            return true;
        }
 
        bool disallowIntercept;
        public override void RequestDisallowInterceptTouchEvent(bool disallowIntercept)
        {
            this.disallowIntercept = disallowIntercept;
            Shared.HDLUtils.WriteLine($"{GetType()} Height->{Height} RequestDisallowInterceptTouchEvent->{disallowIntercept}");
            base.RequestDisallowInterceptTouchEvent(disallowIntercept);
            Parent?.RequestDisallowInterceptTouchEvent(disallowIntercept);
        }
 
    }
}