Hello,
Welcome to Microsoft Q&A!
You can use custom renderer
to achieve this function.
In xamarin Ios:
1.Define five page in TabbedPage , make the third one's title empty (leave space for the extra button).
<ContentPage Title="Tab 1" />
<ContentPage Title="Tab 2" />
<ContentPage Title="" />
<ContentPage Title="Tab 3" />
<ContentPage Title="Tab 4" />
2.Customize button (position , backgroundColor, corner radius, click event ) ,add it as subview on tabbedPage , disable the third tab click event.
[assembly : ExportRenderer(typeof(TabbedPage),typeof(MyRenderer))]
namespace FormsApp.iOS
{
public class MyRenderer :TabbedRenderer
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
UIButton btn = new UIButton(frame: new CoreGraphics.CGRect(0, 0, 60, 60));
this.View.Add(btn);
//customize button
btn.ClipsToBounds = true;
btn.Layer.CornerRadius = 30;
btn.BackgroundColor = UIColor.Red;
btn.AdjustsImageWhenHighlighted = false;
//move button up
CGPoint center = this.TabBar.Center;
center.Y = center.Y - 20;
btn.Center = center;
//button click event
btn.TouchUpInside += (sender,ex) =>
{
//use mssage center to inkove method in Forms project
};
//disable jump into third page
this.ShouldSelectViewController += (UITabBarController tabBarController, UIViewController viewController) =>
{
if (viewController == tabBarController.ViewControllers[2])
{
return false;
}
return true;
};
}
}
}
The result is:
Update
And for shell, you can refer article Xamarin.Forms Shell: Customizing the TabBar (Android) .
For this function code in iOS, you could refer to the following link: https://stackoverflow.com/questions/58635349/xamarin-forms-shell-custom-icon-for-selected-tab.
And there is a similar thead, you can check it here: https://learn.microsoft.com/en-us/answers/questions/170862/xamarin-bottom-custom-tab-bar.html .
Best Regards,
Jessie Zhang
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.