xamarin.forms - Xamarin Forms:如何将 contentPage 工具栏图像居中对齐?
问题描述
我通过以下代码向工具栏添加了一个图标,但是如何将其对齐到中心。现在它在右端。在这个线程中告诉它在 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/
推荐阅读
- javascript - 过滤 DynamoDB 查询以排除值(DynamoDB、Javascript)
- javascript - 可以修改此脚本以使其切换到页面的链接吗?
- c# - 以 Windows 用户身份启动浏览器进程
- r - 带有 xreg 的 auto.arima 在 do.call 中不起作用
- c++ - 为什么 [[nodiscard]] 不适用于参考?
- java - 获取数组中连续元素之间的绝对差值,并返回出现最多的差值
- javascript - jquery-2.1.1.min.js 在 opencart 2.0.2.0 中导致混合内容错误
- reactjs - Typescript React HOC 错误与提升非反应静态
- json - 是否可以将对象作为枚举成员
- javascript - 导出代码块而不仅仅是函数