How can I get a horizontal line above tab bar on Android and IOS? Here is a similar question on stack overflow for xamarin forms. I tried to use the new handler. But I don't know if I am doing it right.
Microsoft.Maui.Handlers.TabbedViewHandler.Mapper.AppendToMapping(nameof(IView.Background), (handler, view) =>
{
if (view is BottomNavigationView )
{
#if __ANDROID__
Android.Graphics.Drawables.ShapeDrawable line = new()
{
Alpha = 255
};
line.Paint.Color = Colors.Black.ToAndroid();
line.Paint.SetStyle(Android.Graphics.Paint.Style.Fill);
var layerDrawable = new LayerDrawable(new Drawable[] { line });
layerDrawable.SetLayerInset(0, 0, 0, 0, int.Parse((view.Height - 4).ToString()));
(handler.PlatformView as global::Android.Views.View).SetBackground(layerDrawable);
#endif
}
});