Remove left space in title view xamarin forms

淺唱寂寞╮ 提交于 2021-02-08 10:08:01

问题


I had an issue in removing the extra left space in title view as shown in the image below please see the screenshot here

Ps: I'm using tabbed page and that bar is the navigation title view.


回答1:


Set the xml below in your Toolbar.xml of Android part.

app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp" 

Do not forget to add the namespace of app in your Toolbar.xaml.

xmlns:app="http://schemas.android.com/apk/res-auto"

And check the code below, it need to be added in MainActivity.cs.

ToolbarResource = Resource.Layout.Toolbar;

Usage:

<NavigationPage.TitleView>
    <Label Text="Repositories" />
</NavigationPage.TitleView>



来源:https://stackoverflow.com/questions/60829018/remove-left-space-in-title-view-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!