Xamarin Forms:如何将 contentPage 工具栏图像居中对齐?
Xamarin Forms: How to align the contentPage toolbar image to center?
我已经通过以下代码在工具栏中添加了一个图标,但如何才能将其居中对齐。现在它在右端。在 线程中告诉它在 xamarin 表单中是不可能的。
<ContentPage.ToolbarItems>
<ToolbarItem Icon="logo-final.jpg"/>
</ContentPage.ToolbarItems>
我需要像下面屏幕一样位于中心的图标。
请为此功能提出解决方案?
您应该尝试导航标题视图
<ContentPage>
<NavigationPage.TitleView>
<StackLayout Orientation="Horizontal" VerticalOptions="Center" Spacing="10">
<Image Source="iconXamagon.png">
</Image>
</StackLayout>
</NavigationPage.TitleView>
...
</ContentPage>
更多参考https://montemagno.com/xamarin-forms-icons-in-navigation-toolbar/
我已经通过以下代码在工具栏中添加了一个图标,但如何才能将其居中对齐。现在它在右端。在
<ContentPage.ToolbarItems>
<ToolbarItem Icon="logo-final.jpg"/>
</ContentPage.ToolbarItems>
我需要像下面屏幕一样位于中心的图标。
请为此功能提出解决方案?
您应该尝试导航标题视图
<ContentPage>
<NavigationPage.TitleView>
<StackLayout Orientation="Horizontal" VerticalOptions="Center" Spacing="10">
<Image Source="iconXamagon.png">
</Image>
</StackLayout>
</NavigationPage.TitleView>
...
</ContentPage>
更多参考https://montemagno.com/xamarin-forms-icons-in-navigation-toolbar/