Xamarin形成Android工具栏项目的位置 [英] Xamarin forms position of toolbar items for android

查看:79
本文介绍了Xamarin形成Android工具栏项目的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望ToolbarItem Menu1在左侧,但目前两者都在右侧. 我该如何解决?

I want the ToolbarItem Menu1 on the left side, but at this moment both are on right side. How can I fix that?

<?xml version="1.0" encoding="UTF-8"?>
 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Dharma.LoginPage">
   <ContentPage.ToolbarItems>
     <ToolbarItem Name="Menu1" Order="Primary" Priority="0" />
     <ToolbarItem Name="Menu2" Order="Primary" Priority="1" />
   </ContentPage.ToolbarItems>
   <ContentPage.Content>
     <StackLayout Padding="30">
       <Label Text="Login Page" FontSize="20" />
     </StackLayout>
   </ContentPage.Content>
 </ContentPage>

推荐答案

正如其他人所提到的,只能使用 answer 有关如何将项目向左移动的更多详细信息-涉及到这种情况,因此,仅将它们放在右侧是一个更好的主意.

As others have mentioned, this can only be done using a custom renderer for your Page. Then you need to move all the menu item creation logic there since Xamarin's built in ToolbarItem will cause all sorts of issues with your custom logic. You can refer to this answer for more details on how to move your items to the left - it's kind of involved, so perhaps it's a better idea to just live with having them on the right.

这篇关于Xamarin形成Android工具栏项目的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆