问题
Below is my XAML page for my MasterDetailPage:
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
mc:Ignorable="d"
x:Class="JapaneseLearnPrism.Views.MenuPage">
<MasterDetailPage.Master>
<NavigationPage Title="Menu" Icon="ic_hamburger.png">
<x:Arguments>
<ContentPage Title="{Binding Title}">
<!--Content for my menus here.-->
</ContentPage>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Master>
</MasterDetailPage>
And this is how I set up the Page Path for Prism:
protected override async void OnInitialized()
{
InitializeComponent();
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.Application.SetWindowSoftInputModeAdjust(this, Xamarin.Forms.PlatformConfiguration.AndroidSpecific.WindowSoftInputModeAdjust.Resize);
// await NavigationService.NavigateAsync("NavigationPage/MainPage");
await NavigationService.NavigateAsync(nameof(MenuPage) + "/" + nameof(NavigationPage) + "/" + nameof(Views.MainPage));
}
This is works fine for the MD page function. And the hamburger icon is correctly showing in Android but not iOS. I am wondering why. I searched online everyone but actually nothing solved. Hope be able to get the answer here.
Thanks.
回答1:
Use IconImageSource inside MasterDetailPage to display HamburgerIcon as far as Android is concern it uses it's default hamburger Icon that's why it is showing in Android and not in iOS.
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
mc:Ignorable="d"
IconImageSource="ic_hamburger.png"
x:Class="JapaneseLearnPrism.Views.MenuPage">
来源:https://stackoverflow.com/questions/60228891/hamburger-icon-not-showing-on-ios-developed-by-prism-for-xamarin-forms