How to add a border in bottom menu in xamarin.forms shell?

mc 3,701 Reputation points
2021-09-15T08:28:21.097+00:00

I set the bottom menu tab bar to #ffffff. and can add a border in it?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,297 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,901 Reputation points Microsoft Vendor
    2021-09-15T09:22:28.643+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Do you want to achieve the result like following screenshot?

    132285-image.png

    If so, you can create a custom renderer for Shell. Here is a similar thread:

       [assembly: ExportRenderer(typeof(AppShell), typeof(CustomShellRenderer))]  
       namespace ShellDemo.Droid  
       {  
           public class CustomShellRenderer : ShellRenderer  
           {  
               public CustomShellRenderer(Context context) : base(context)  
               {  
               }  
         
               protected override IShellBottomNavViewAppearanceTracker CreateBottomNavViewAppearanceTracker(ShellItem shellItem)  
               {  
                   return new CustomBottomNavView();  
               }  
           }  
         
           public class CustomBottomNavView : IShellBottomNavViewAppearanceTracker  
           {  
               public void Dispose()  
               {  
         
               }  
         
               public void ResetAppearance(BottomNavigationView bottomView)  
               {  
         
               }  
         
               public void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)  
               {  
                   bottomView.SetBackgroundColor(Android.Graphics.Color.White);  
               }  
           }  
       }  
    

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful