The behavior of the navigation experience between flyout and detail pages is platform dependent:
- On iOS, the detail page slides to the right as the flyout page slides from the left, and the left part of the detail page is still visible.
- On Android, the detail and flyout pages are overlaid on each other.
- On UWP, the flyout page slides from the left over part of the detail page, provided that the FlyoutLayoutBehavior property is set to
Popover. It it the deault behavior of different platform which we
could not change
I need a custom renderer for Xamarin Shell that changes the behaviour of Android to be similar to IOS one. Uploaded sample code
public class CustomShellRenderer : ShellRenderer { public CustomShellRenderer(Context context) : base(context) { }
protected override IShellFlyoutContentRenderer CreateShellFlyoutContentRenderer()
{
//var flyoutContentRenderer = base.CreateShellFlyoutContentRenderer();
//var flyoutbackground = AppCompatResources.GetDrawable(Platform.CurrentActivity, Resource.Drawable.flyoutbackground);
if (Android.OS.Build.VERSION.SdkInt > Android.OS.BuildVersionCodes.O)
{
//flyoutbackground.SetColorFilter(new BlendModeColorFilter(
// Shell.Current.FlyoutBackgroundColor.ToAndroid(), BlendMode.Color));
//flyoutContentRenderer.AndroidView.SetBackground(flyoutbackground);
}
else
{
//flyoutbackground.SetColorFilter(Shell.Current.FlyoutBackgroundColor.ToAndroid(), PorterDuff.Mode.Src);
//flyoutContentRenderer.AndroidView.SetBackgroundDrawable(flyoutbackground);
}
//return flyoutContentRenderer;
}
}
1条答案
按热度按时间xn1cxnb41#
FlyoutPage
如何管理弹出和详细页面取决于应用程序是在电话上还是在平板电脑上运行、设备的方向以及FlyoutLayoutBehavior属性的值。此属性确定详细页面的显示方式。可能的值为:下面的XAML代码示例演示如何在FlyoutPage上设置
FlyoutLayoutBehavior
属性:注意事项:
FlyoutLayoutBehavior
属性的值仅影响在平板电脑或桌面上运行的应用程序。在手机上运行的应用程序始终具有Popover
行为。有关详细信息,请参阅文档:控制详细信息页面布局行为。