简体   繁体   中英

How to remove space in white?

When I select succes and development the trail screen is the one that follows but in the menu there is no such space, but from the menu to the trial page, in between these two is the masterpage

[ 在此处输入图片说明 [ 图像仪表板 1

I want remove this space in white, but i did not not add padding in contentpage, I dont know what to do, however I added a NavigationPage.HasNavigationBar=true , but I cant control on top before of NavigationBar. Also if I add padding to the contentpage it is only modified after the NavigationBar.

I've noticed if changed emulator of api 19 this space in white not exist. The screenshots are, on the left: 5.2 Marshmallow(6.0.0)XXHDPI Phone (Android 6.0 -Api 23) and right is: 5 Kitkat (4.4) XXHDPI Phone (Andoid 4.4 - API 19)

this is my code xml:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="DefinityFirst.Mobile.Pages.SuccessAndDev.Dashboard"
             xmlns:ctrl="clr-namespace:DefinityFirst.Mobile.Pages.SuccessAndDev.Accordion;assembly=DefinityFirst.Mobile"
             Title="Trails"

         NavigationPage.HasNavigationBar="true"
             xmlns:control="clr-namespace:DefinityFirst.Mobile.Pages.SuccessAndDev;assembly=DefinityFirst.Mobile"

               >
  <!--<ContentPage.Padding>
  <OnPlatform x:Key="GeneralPadding2"
                        x:TypeArguments="Thickness"
                        iOS="10"
                        Android="0,10,0,0"
                        WinPhone="15"/>
  </ContentPage.Padding>-->
  <!--<ContentPage.Padding>
    <OnPlatform x:TypeArguments="Thickness" iOS="20, 40, 20, 20" Android="20, 20, 20, 20" WinPhone="20, 20, 20, 20" />
  </ContentPage.Padding>-->
  <ContentPage.Content>


    <ContentView>
      <!--CONTENEDOR TRAIL; LEVEL; PROGRESBAR-->
      <StackLayout BackgroundColor="#F5F5F5">
        <Frame Padding="3,1,1,2.5"  HasShadow="True" Margin="10">
          <StackLayout BackgroundColor="#E1E1E1">
            <StackLayout Orientation="Vertical" BackgroundColor="#1F549D" Padding="5,0,0,0">
              <StackLayout Orientation="Vertical"  Padding="5,5,5,5" x:Name="stTrails" BackgroundColor="White">
                <Label Text="{Binding Name}" TextColor="#FF020202"  FontSize="18" FontAttributes="Bold"/>
                <StackLayout Orientation="Horizontal"  x:Name="nameLevel">
                  <Label Text="{Binding Name}" TextColor="#FF020202" FontSize="16" HorizontalOptions="StartAndExpand"/>
                  <Image Source="mayorq.png"  HorizontalOptions="EndAndExpand"/>
                </StackLayout>
                <StackLayout Orientation="Vertical">
                  <ProgressBar  Progress="{Binding ProgressLevel}"   WidthRequest="500" HeightRequest="15"  HorizontalOptions="StartAndExpand"  x:Name="progresBar"/>
                  <!--<control:CustomProgressBar x:Name="progressBar2" Progress=".02"  />-->
                </StackLayout>
              </StackLayout>
            </StackLayout>
          </StackLayout>
        </Frame>

        <StackLayout Orientation="Horizontal" Padding="4,1,1,2.5">
          <Label  Text="Item List" FontSize="15.8" HorizontalOptions="StartAndExpand"  Margin="10"/>
          <Picker x:Name="pickerStatusFilter"  Title="Filter by status"  HorizontalOptions="EndAndExpand" TextColor="#FF020202"/>
        </StackLayout>
        <!--<BoxView/>
      <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Spacing="50">
        <Button Text="a" HorizontalOptions="FillAndExpand" TextColor="{StaticResource MainColor}" BackgroundColor="Aqua"/>
        <Button Style="{StaticResource MainButton}" Text="b"/>
        <Button Text="c" HorizontalOptions="FillAndExpand"/>
      </StackLayout>-->
        <!--<StackLayout  Orientation="Horizontal">
      </StackLayout>-->
        <!--ACCORDION-->
        <StackLayout Padding="0,0,0,0" BackgroundColor="White">
          <ScrollView>
            <ctrl:Accordion x:Name="SecOne" FirstExpaned = "true"/>
          </ScrollView>
        </StackLayout>
      </StackLayout>
    </ContentView>


  </ContentPage.Content>
</ContentPage>

Master Page:

<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
                  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                  x:Class="DefinityFirst.Mobile.Pages.SuccessAndDev.MasterPage"
                  xmlns:pages="clr-namespace:DefinityFirst.Mobile.Pages.SuccessAndDev;assembly=DefinityFirst.Mobile"
                  NavigationPage.HasNavigationBar="false">
    <MasterDetailPage.Master>
        <pages:MenuPage x:Name="menuPage" />
    </MasterDetailPage.Master>
    <MasterDetailPage.Detail>
        <NavigationPage x:Name="Navigator" BarBackgroundColor="{StaticResource MainColor}">
            <x:Arguments>
                <pages:Dashboard/>
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>
</MasterDetailPage>

I can't reproduce this issue using a MasterDetailPage with the latest Xamarin.Forms 2.3.3.175. Both API 19 and API 23+ are not showing any extra space like shown in your images. Try the sample code from here and see if you have the same issue. If not, I suspect something else is wrong in the implementation of the app. An example of using the MD page:

<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" 
                  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
                  xmlns:local="clr-namespace:MasterDetailPageNavigation;assembly=MasterDetailPageNavigation"
                  x:Class="MasterDetailPageNavigation.MainPage">
  <MasterDetailPage.Master>
    <local:MasterPage x:Name="masterPage" />
  </MasterDetailPage.Master>
    <MasterDetailPage.Detail>
        <NavigationPage>
            <x:Arguments>
                <local:ContactsPage />
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>
</MasterDetailPage>

If you can update your post with more code of how you are implementing the MDP, I will take a look and update my answer.

I encountered this problem too, now i decompile xamarin,and found MasterDetailPageRenderer->SetElement(), if sdk>=21 it set TopPadding = GetStatusBarHeight(); but i find xamarin's source,it changed. I think will soon be modified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM