Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin forms position of toolbar items for android

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>
like image 899
Ali Eren Avatar asked Apr 19 '16 11:04

Ali Eren


2 Answers

This is not Feasible solution. I know but for now I have tried this. just add blank toolbaritems between menu1 and menu2 to create space between them.

So it will set at left and right accordingly

<ContentPage.ToolbarItems>
 <ToolbarItem Name="Menu1" Order="Primary" Priority="0" />
 <ToolbarItem Name="" Order="Primary" Priority="0" />
 <ToolbarItem Name="" Order="Primary" Priority="0" />
 <ToolbarItem Name="" Order="Primary" Priority="0" />
 <ToolbarItem Name="" Order="Primary" Priority="0" />
 <ToolbarItem Name="Menu2" Order="Primary" Priority="1" />

like image 122
Neelam Prajapati Avatar answered Oct 07 '22 21:10

Neelam Prajapati


This isn't currently supported in Forms. To get around it, you could write a Custom Renderer that overrides the base Android toolbar renderer.

like image 41
Jason Avatar answered Oct 07 '22 21:10

Jason