这个问题类似于这些(1、2和3)问题,但他们的解决方案都没有解决我的问题。
问题是一样的,我需要删除左侧的填充TitleView
,如下所示:
我创建了一个自定义Toolbar
布局,定义为:
<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"/>
在调用我ToolbarResource
的. 填充物仍然存在。Resource.Layout.Toolbar
base.OnCreate(savedInstanceState);
MainActivity.cs
<NavigationPage.TitleView> ... </NavigationPage.TitleView>
似乎自定义Toolbar
布局不会覆盖Shell
的导航栏,而是NavigationPage
s。我正在使用Shell.TitleView
.
有谁知道如何覆盖和删除Shell
导航栏中的填充?