so for example
<ContentPage.ToolbarItems>
<ToolbarItem Name="logo" Icon="businessName.png" Priority="0" Order="Primary"/>
<ToolbarItem Name="shoppingCartImage" Icon="shopping_cart_IMG.png" Priority="0" Order="Primary"/> Activated="Onclick" />
<ToolbarItem x:Name="NumberOfItemsInCart" Priority="0" Order="Primary"/>
</ContentPage.ToolbarItems>
will display all items to the right of the toolbar...I would like the logo in the centre and then shopping cart image and label for number in shopping cart to the right...
Read many examples online regarding creating a customer render...(Xamarin forms position of toolbar items for android)
is this still the case? as these Q's were asked years ago...has xamarin been updated to include alignment of items in the toolbar or do I need to create a custom render... please advise thank you
This issue(cannot set the icon to center in xamarin forms code) just happened in Android, you do not need to create a custom renderer in Android.
First of all, please open the
Toolbar.xmlfile in Resources/layout folder,this is what you set in theMainActivity, which Xamarin.Forms will use to inflate it. Add aImageViewto theandroid.support.v7.widget.Toolbarlike following code.Here is running screenshot.
Here is a helpful link, you can refer to it.
https://montemagno.com/xamarin-forms-icons-in-navigation-toolbar/