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
I'm struggling about how to add a shadow to the shell bottom tabbar.
My issue is similar to xamarin/Xamarin.Forms#5988 , but mine is in MAUI.
I tried to set a border top with the alpha property trying to make a similar effect but i can't do it.
Here is the code:
using Android.Graphics.Drawables;
using Android.Views;
using Android.Widget;
using Google.Android.Material.BottomNavigation;
using Microsoft.Maui.Controls.Platform;
using Microsoft.Maui.Controls.Platform.Compatibility;
using Microsoft.Maui.Platform;
namespace ViewScreen.Platforms.Android
{
public class CustomShellBottomNavViewAppearanceTracker : ShellBottomNavViewAppearanceTracker
{
private readonly IShellContext shellContext;
public CustomShellBottomNavViewAppearanceTracker(IShellContext shellContext, ShellItem shellItem) : base(shellContext, shellItem)
{
this.shellContext = shellContext;
}
public override void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)
{
base.SetAppearance(bottomView, appearance);
var backgroundDrawable = new GradientDrawable();
backgroundDrawable.SetShape(ShapeType.Rectangle);
backgroundDrawable.SetColor(Colors.White.ToPlatform());
backgroundDrawable.SetStroke(2,Colors.Black.ToPlatform());
bottomView.SetBackground(backgroundDrawable);
// Asegúrate de que no haya relleno interno que desplace el contenido
bottomView.SetPadding(0, 0, 0, 0);
bottomView.LabelVisibilityMode = LabelVisibilityMode.LabelVisibilityUnlabeled;
}
protected override void SetBackgroundColor(BottomNavigationView bottomView, Color color)
{
base.SetBackgroundColor(bottomView, color);
bottomView.RootView?.SetBackgroundColor(shellContext.Shell.CurrentPage.BackgroundColor.ToPlatform());
}
}
}
s/question ?Further information is requestedarea-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingarea-controls-shellShell Navigation, Routes, Tabs, Flyout
1 participant
Converted from issue
This discussion was converted from issue #27252 on February 11, 2025 22:11.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm struggling about how to add a shadow to the shell bottom tabbar.
My issue is similar to xamarin/Xamarin.Forms#5988 , but mine is in MAUI.
I tried to set a border top with the alpha property trying to make a similar effect but i can't do it.
Here is the code:
Beta Was this translation helpful? Give feedback.
All reactions