2016-11-27 43 views
1

當我在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 <項目名稱= 「機器人:windowActionBar」>假 <項目名稱= 「windowActionBar」>假 <項目名稱= 「機器人:windowTitleSize」> 0dp 不行,還是錯誤.. 我使用這個perent「Theme.AppCompat.Light.NoActionBar」 並沒有任何變化 –

+0

嘗試添加 true to your styles.xml – HeisenBerg

回答

0

你能夠改變很多在Android解決方案(MainActivity.cs)正下方的命名空間設置。

例如:

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