如何删除窗口顶部的额外填充?

问题描述:

当我在Android上运行我的应用程序时,我有这个奇怪的填充顶部。在iOS上,它看起来和预期一样。如何删除窗口顶部的额外填充?

当我检查填充是0为所有方向。我最后的想法是,它可能与我的一些布局有关,但我不明白这可能是什么。

工具栏布局:

<?xml version="1.0" encoding="UTF-8"?> 
<android.support.v7.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="?attr/actionBarSize" 
    android:minHeight="?attr/actionBarSize" 
    android:background="?attr/colorPrimary" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
    app:layout_scrollFlags="scroll|enterAlways"/> 

标签布局

<?xml version="1.0" encoding="UTF-8"?>  
<android.support.design.widget.TabLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/sliding_tabs" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimary" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:tabIndicatorColor="@android:color/white" 
    app:tabGravity="fill" 
    app:tabMode="fixed" /> 

我使用Xamarin.Form的MasterDetailPage与我的网页是ContentPage。 这个页面组合是否在Android上创建这个错误?请帮我修复它。

这里是我所看到的截图:

[Example] 1

+0

这是为动作条的空间。尝试在您的styles.xml中将 false添加到您的主题中。 – HeisenBerg

+0

@HeisenBerg 假 假 0dp 不行,还是错误.. 我使用这个perent“Theme.AppCompat.Light.NoActionBar” 并没有任何变化 –

+0

尝试添加 true to your styles.xml – HeisenBerg

你能够改变很多在Android解决方案(MainActivity.cs)正下方的命名空间设置。

例如:

[Activity(Theme = "@style/AppStyle.Light", Label = "ProjectName", MainLauncher = false, 
    ScreenOrientation = ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]