protected override void OnLayout(bool changed, int left, int top, int right, int bottom) { base.OnLayout(changed, left, top, right, bottom); if (_adapter == null) { return; } for (int i = 0; i < _adapter.Count; i++) { View currentView = _adapter.GetView(i, null, this); AbsoluteLayout.LayoutParams layoutParameters = currentView.LayoutParameters as AbsoluteLayout.LayoutParams; if (layoutParameters == null) { continue; } AddViewInLayout(currentView, i, currentView.LayoutParameters, true); currentView.Measure(MeasureSpec.MakeMeasureSpec(Width, MeasureSpecMode.AtMost), MeasureSpec.MakeMeasureSpec(Height, MeasureSpecMode.AtMost)); } for (int i = 0; i < ChildCount; i++) { View currentView = GetChildAt(i); AbsoluteLayout.LayoutParams layoutParameters = currentView.LayoutParameters as AbsoluteLayout.LayoutParams; if (layoutParameters == null) { continue; } int viewLeft = layoutParameters.X; int viewTop = layoutParameters.Y; int viewRight = layoutParameters.X + layoutParameters.Width; int viewBottom = layoutParameters.Y + layoutParameters.Height; currentView.Layout(viewLeft, viewTop, viewRight, viewBottom); } //Invalidate(); }
protected override AWebView CreateNativeView() { var aWebView = new MauiWebView(Context !) { #pragma warning disable 618 // This can probably be replaced with LinearLayout(LayoutParams.MatchParent, LayoutParams.MatchParent); just need to test that theory LayoutParameters = new AbsoluteLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent, 0, 0) #pragma warning restore 618 }; if (aWebView.Settings != null) { aWebView.Settings.JavaScriptEnabled = true; aWebView.Settings.DomStorageEnabled = true; } return(aWebView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var rootView = inflater.Inflate(Resource.Layout.fragment, null); var containerMap = (FrameLayout) rootView.FindViewById(Resource.Id.container_map); var mapView = base.OnCreateView(inflater, container, savedInstanceState); containerMap.AddView(mapView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); var map = Map; map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(48.35, 31.16), 5.5f)); map.UiSettings.RotateGesturesEnabled = false; map.SetOnMapClickListener(this); map.SetOnMarkerClickListener(this); map.Clear(); _spots.Clear(); var icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.pin); foreach (var spot in SpotsArray) { var mo = new MarkerOptions(); mo.SetPosition(spot.Position); mo.SetIcon(icon); mo.SetTitle(spot.Name); mo.SetSnippet("foo"); var marker = map.AddMarker(mo); _spots.Add(marker.Id, new AnnotationModel(marker, spot)); } _infoWindowContainer = rootView.FindViewById(Resource.Id.container_popup); // Subscribe to resize pop-up window _infoWindowLayoutListener = new InfoWindowLayoutListener(); _infoWindowContainer.ViewTreeObserver.AddOnGlobalLayoutListener(_infoWindowLayoutListener); OverlayLayoutParams = (AbsoluteLayout.LayoutParams) _infoWindowContainer.LayoutParameters; textView = (TextView) _infoWindowContainer.FindViewById(Resource.Id.textview_title); _button = (Button) _infoWindowContainer.FindViewById(Resource.Id.foo); _button.SetOnClickListener(this); return rootView; }