删除标题视图 xamarin 表单中的左侧空间 [英] Remove left space in title view xamarin forms

查看:85
本文介绍了删除标题视图 xamarin 表单中的左侧空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在删除标题视图中多余的左侧空间时遇到问题,如下图所示

不要忘记在 Toolbar.xaml 中添加 app 的命名空间.

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

并检查下面的代码,它需要添加到MainActivity.cs.

ToolbarResource = Resource.Layout.Toolbar;

用法:

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

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.

解决方案

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>

这篇关于删除标题视图 xamarin 表单中的左侧空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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