Xamarin表单:在屏幕底部获取一段空白区域

时间:2017-12-04 05:59:01

标签: android xamarin xamarin.forms xamarin.android

我是Xamarin世界的新手,我遇到了一个奇怪的问题。我的所有屏幕都在页面底部有一个导航栏,导航栏下方似乎有一段白色空间,如下所示:

enter image description here

这是模拟器的屏幕截图,蓝色部分是导航栏的底部,空白区域是我想要删除的空白区域。忽略黑色部分,使用绝对底部的按钮,这只是模拟器。

基本上,我想让Scroll进入这个空白区域。作为旁注,导航栏以编程方式添加,导航栏正上方的内容包含在滚动容器中。目前,我正在使用Galaxy安卓手机和模拟器设置为" Android_Accelerated_Nougat"。

这个问题可能是什么?我可以在可能的嫌疑人身上检查什么?这个问题有没有解决方法?

更新

这是.xaml文件:

        <?xml version="1.0" encoding="utf-8" ?>
<views:BaseContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:customRenderer="clr-namespace:MyNamespace.MyCustomRenderer;assembly=MyNamespace"
             xmlns:views="clr-namespace:MyNamespace.Views;assembly=MyNamespace"
             x:Class="MyNamespace.Views.CompanyEditPage">
 <Grid >
    <Image Source="backgroundImg” Aspect="AspectFill" />
    <ActivityIndicator x:Name="actIndicator” VerticalOptions="CenterAndExpand" Color="White" HorizontalOptions="CenterAndExpand" />
  <StackLayout VerticalOptions="Start">
    <ScrollView>\
      <StackLayout >        
        <StackLayout VerticalOptions="Start" HorizontalOptions="FillAndExpand">
          <StackLayout VerticalOptions="Start"
                        HorizontalOptions="FillAndExpand"
                        Orientation="Vertical"
                        Padding="20,10">
                        <Image x:Name="saveprofilebutton" Source="savebtn.png" Aspect="AspectFill" HeightRequest="40" HorizontalOptions="EndAndExpand">
              <Image.GestureRecognizers>
                <TapGestureRecognizer Tapped="Save_OnTapped" />
              </Image.GestureRecognizers>
            </Image>
            <Image Source="companylogo.png"
                   HorizontalOptions="CenterAndExpand"
                   VerticalOptions="CenterAndExpand"/>
          </StackLayout>
          <BoxView BackgroundColor="#6182c6"
                   HeightRequest="1"/>
        </StackLayout>
        <StackLayout VerticalOptions="Start"
                          HorizontalOptions="FillAndExpand">
          <StackLayout VerticalOptions="CenterAndExpand"
                        HorizontalOptions="FillAndExpand"
                        Orientation="Horizontal"
                       Padding="50,0,40,0">
            <Label Text="Edit company membership"
                  TextColor="White"
                  FontSize="16"
                   HorizontalOptions="StartAndExpand"
                   VerticalOptions="CenterAndExpand"/>
            <Image x:Name="companymembershipimg" Source="arrow.png"
                   HorizontalOptions="EndAndExpand" >
              <Image.GestureRecognizers>
                <TapGestureRecognizer Tapped="EditMembership_OnTapped"/>
              </Image.GestureRecognizers>
            </Image>
          </StackLayout>
          <BoxView BackgroundColor="#6182c6"
                   HeightRequest="1"/>
        </StackLayout>
        <StackLayout VerticalOptions="Start"
                           HorizontalOptions="FillAndExpand">
          <StackLayout VerticalOptions="CenterAndExpand"
                       HorizontalOptions="FillAndExpand"
                       Orientation="Vertical"
                       Spacing="0">
            <StackLayout VerticalOptions="Start"
                     HorizontalOptions="FillAndExpand"
                     Orientation="Horizontal"
                         Padding="50,10,40,10">

              <Label  Text="Activity Start Date”
                    TextColor="White"
                    FontSize="16"
                     HorizontalOptions="StartAndExpand"
                      VerticalOptions="CenterAndExpand"/>

              <customRenderer:MyTimePicker x:Name="MyActivityStartTimePicker"
                                           Unfocused="ActivityStartTime_Unfocused"
                                           HorizontalOptions="EndAndExpand"
                                           VerticalOptions="Center"/>
            </StackLayout>

            <StackLayout VerticalOptions="Start"
                    HorizontalOptions="FillAndExpand"
                    Orientation="Horizontal"
                         Padding="50,0,40,0">

              <Label  Text="Activity End Date”
                    TextColor="White"
                    FontSize="16"
                     HorizontalOptions="StartAndExpand"/>
              <customRenderer:MyTimePicker x:Name="MyActivityEndTimePicker"
                                           Unfocused="ActivityEndTime_Unfocused"
                                           HorizontalOptions="EndAndExpand"
                                           VerticalOptions="Center"/>
            </StackLayout>
          </StackLayout>
          <BoxView BackgroundColor="#6182c6"
                   HeightRequest="1"/>
        </StackLayout>
        <StackLayout>
          <StackLayout VerticalOptions="Start"
                                  HorizontalOptions="FillAndExpand"
                                 Orientation="Vertical"
                                 Spacing="10"
                                  Padding="50,20,40,20">              
        <Label >
              <Label.FormattedText>
                <FormattedString>
                  <Span Text="I want to update members every "
                        ForegroundColor="White"
                        FontSize="16" />
                  <Span x:Name="TimeRange”
                        Text="15"
                        ForegroundColor="White"
                       FontSize="16" />
                  <Span Text=" day(s)."
                        ForegroundColor="White"
                        FontSize="16" />
                </FormattedString>
              </Label.FormattedText>
            </Label>
            <customRenderer:MySlider x:Name="MySlider”
                                     Maximum="28"
                                     Minimum="1"
                                       ValueChanged="MySlider_OnValueChanged"
                                     Unfocused="MySlider_OnUnfocused"/>
            <StackLayout Orientation="Horizontal"
                           HorizontalOptions="CenterAndExpand"
                            Spacing="0" Margin="0" Padding="1" BackgroundColor="White">

              <Label x:Name="LblSunday” WidthRequest="36" TextColor="White" HeightRequest="28" FontSize="18" BackgroundColor="#00158f" Text="Su" Margin="1" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Sunday_OnTapped" />
                </Label.GestureRecognizers>
              </Label>

              <Label x:Name="LblMonday” WidthRequest="36" HeightRequest="28" FontSize="18" BackgroundColor="#00158f" TextColor="White" Text="Mo" Margin="1" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Monday_OnTapped"/>
                </Label.GestureRecognizers>
              </Label>

              <Label x:Name="LblTuesday” BackgroundColor="#00158f" WidthRequest="36" HeightRequest="28" FontSize="18" Text="Tu" Margin="1"  TextColor="White" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Tuesday_OnTapped"/>
                </Label.GestureRecognizers>
              </Label>

              <Label x:Name="LblWednesday” BackgroundColor="#00158f" TextColor="White" WidthRequest="36" HeightRequest="28" FontSize="18" Text="We" Margin="1" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Wednesday_OnTapped"/>
                </Label.GestureRecognizers>
              </Label>

              <Label x:Name="LblThursday” BackgroundColor="#00158f" WidthRequest="36" TextColor="White" HeightRequest="28" FontSize="18" Text="Th" Margin="1" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Thursday_OnTapped" />
                </Label.GestureRecognizers>
              </Label>

              <Label x:Name="LblFriday” BackgroundColor="#00158f" TextColor="White" WidthRequest="36" HeightRequest="28" FontSize="18" Text="Fr" Margin="1" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Friday_OnTapped" />
                </Label.GestureRecognizers>
              </Label>

              <Label x:Name="LblSaturday” BackgroundColor="White" Text="Sa"  WidthRequest="32" HeightRequest="28" FontSize="18" TextColor="#00158f" Margin="1" HorizontalTextAlignment="Center"  VerticalTextAlignment="Center">
                <Label.GestureRecognizers>
                  <TapGestureRecognizer Tapped="Saturday_OnTapped"/>
                </Label.GestureRecognizers>
              </Label>
            </StackLayout>
          </StackLayout>
          <BoxView BackgroundColor="#6182c6"
                   HeightRequest="1"/>
        </StackLayout>
        <StackLayout VerticalOptions="StartAndExpand"
                     HorizontalOptions="FillAndExpand">

          <StackLayout VerticalOptions="CenterAndExpand"
                       HorizontalOptions="FillAndExpand"
                       Orientation="Horizontal"
                       Padding="50,20,40,50">
            <Label Text="Activity List"
                   TextColor="White"
                   FontSize="16"
                   HorizontalOptions="StartAndExpand"
                   VerticalOptions="CenterAndExpand"/>
            <Image x:Name="activityimg" Source="arrow.png"
                   HorizontalOptions="EndAndExpand" >
              <Image.GestureRecognizers>
                <TapGestureRecognizer Tapped="ActivityList_OnTapped"/>
              </Image.GestureRecognizers>
            </Image>
          </StackLayout>
        </StackLayout>
      </StackLayout>
    </ScrollView>
  </StackLayout>
</Grid>
</views:BaseContentPage>

0 个答案:

没有答案