You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
If i set a FlyoutBackgroundImage to fill all my flyout, then want to overlay my header so it sits on top of the background image, this works fine on iOS, but on Android it renders a white background on the flyout header area and my FlyoutHeaderTemplate above, not sure if the FlyoutBackgroundImage is behind the white on the FlyoutHeader
I finally found a work around for this using a custom renderer in Android. This works for me, hopefully it'll help others.
using Android.Content;using BeerApp.App.Droid.CustomRenderers;using Xamarin.Forms;using Xamarin.Forms.Platform.Android;[assembly:ExportRenderer(typeof(Shell),typeof(CustomShellRenderer))]namespace BeerApp.App.Droid.CustomRenderers
{publicclassCustomShellRenderer:ShellRenderer{publicCustomShellRenderer(Contextcontext):base(context){}/// <summary>/// This is needed due to bug (https://github.com/xamarin/Xamarin.Forms/issues/6595)/// in Xamarin such that setting the background color/// to Transparent for the content in Shell.FlyoutHeader does not work and shows some/// default underlying color. This sets that underlying color to Transparent./// </summary>/// <returns>The renderer.</returns>protectedoverride IShellFlyoutContentRenderer CreateShellFlyoutContentRenderer(){varrenderer=base.CreateShellFlyoutContentRenderer();if(renderer!=null){varviewGroup=(Android.Views.ViewGroup)renderer.AndroidView;varlinearLayout=(Android.Widget.LinearLayout)viewGroup.GetChildAt(0)!;
linearLayout.SetBackgroundColor(Color.Transparent.ToAndroid());
linearLayout.SetOutlineSpotShadowColor(Color.Transparent.ToAndroid());}returnrenderer!;}}}
If i set a
FlyoutBackgroundImage
to fill all my flyout, then want to overlay my header so it sits on top of the background image, this works fine on iOS, but on Android it renders a white background on the flyout header area and my FlyoutHeaderTemplate above, not sure if the FlyoutBackgroundImage is behind the white on the FlyoutHeaderDescription
Steps to Reproduce
Expected Behavior
Should render a transparent background , the logo png should be above the back.jpg
Actual Behavior
Renderes white background
Basic Information
Screenshots
Reproduction Link
The text was updated successfully, but these errors were encountered: