нет и если нет узнать высоту бара с кнопками?)
void CalculateRealSafeArea() { var activity = (Activity)this; Thickness systemPadding; var decoreView = activity.Window.DecorView; var decoreHeight = decoreView.Height; var decoreWidht = decoreView.Width; var visibleRect = new Rect(); decoreView.GetWindowVisibleDisplayFrame(visibleRect); if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { var screenRealSize = new Android.Graphics.Point(); activity.WindowManager.DefaultDisplay.GetRealSize(screenRealSize); var windowInsets = _relative.RootWindowInsets; if (windowInsets == null) return; var bottomPadding = Math.Min(windowInsets.StableInsetBottom, windowInsets.SystemWindowInsetBottom); systemPadding = new Thickness { Left = this.FromPixels(windowInsets.SystemWindowInsetLeft), Top = this.FromPixels(windowInsets.SystemWindowInsetTop), Right = this.FromPixels(windowInsets.SystemWindowInsetRight), Bottom = this.FromPixels(bottomPadding) }; } else { var screenSize = new Android.Graphics.Point(); activity.WindowManager.DefaultDisplay.GetSize(screenSize); var keyboardHeight = 0d; if (visibleRect.Bottom < screenSize.Y) { keyboardHeight = screenSize.Y - visibleRect.Bottom; } systemPadding = new Thickness { Left = this.FromPixels(visibleRect.Left), Top = this.FromPixels(visibleRect.Top), Right = this.FromPixels(decoreWidht - visibleRect.Right), Bottom = this.FromPixels(decoreHeight - visibleRect.Bottom - keyboardHeight) }; } App.SafeArea = systemPadding; App.KeyboardHeight = keyboardHeight; }
Обсуждают сегодня