Hello,
Can't center Shell Title on Android
You can do it by getting MaterialToolbar
and setting toolbar.TitleCentered=true
in ToolbarHandler
.
Firstly, please remove your above <Shell.TitleView>
code in the AppShell.xaml
Then open your MauiProgram.cs
and find CreateMauiApp
method. Please add following code.
Microsoft.Maui.Handlers.ToolbarHandler.Mapper.AppendToMapping("CustomNavigationView", (handler, view) =>
{
#if ANDROID
Google.Android.Material.AppBar.MaterialToolbar materialToolbar=handler.PlatformView;
materialToolbar.TitleCentered = true;
#endif
});
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.