using System;
using Android.Views;
using Android.Content;
using Android.Util;
using Android.Runtime;
namespace Shared
{
//已经全面检查了代码
///
/// 绝对布局
///
public class FrameLayout : ViewGroup
{
///
/// 当前视图
///
public FrameLayout ()
{
viewGroup = new AndroidFrameLayout (Application.Activity, this);
realViewGroup = viewGroup;
}
///
/// 以传进来的对象为当前对象
///
/// Frame layout.
internal FrameLayout (Android.Widget.FrameLayout frameLayout)
{
viewGroup = frameLayout;
realViewGroup = viewGroup;
}
}
//已经全面检查了代码
///
/// Android原生绝对布局视图 FrameLayout
///
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);
}
}
//已经全面检查了代码
///
/// 已经全面检查代码
///
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);
}
}
}