Xaml 控件从屏幕上推出

Xaml 控件从屏幕上推出,xaml,xamarin.forms,Xaml,Xamarin.forms,我有一个xamarin.forms应用程序。屏幕有许多控件,我使用ScrollView让用户能够看到所有控件。我在ScrollView外有一个按钮,因为我希望它不需要向下滚动屏幕就可以轻松访问。但是我们的一些客户有视力问题,所以他们在手机上放大了文本大小。然后按钮从屏幕上消失。我想知道我能做些什么来解决这个问题。。。若并没有更好的解决方案,我想我会同意只对那个些文本大的人使用滚动。 这是我的密码: <ContentPage.Content> <StackLayout&g

我有一个xamarin.forms应用程序。屏幕有许多控件,我使用ScrollView让用户能够看到所有控件。我在ScrollView外有一个按钮,因为我希望它不需要向下滚动屏幕就可以轻松访问。但是我们的一些客户有视力问题,所以他们在手机上放大了文本大小。然后按钮从屏幕上消失。我想知道我能做些什么来解决这个问题。。。若并没有更好的解决方案,我想我会同意只对那个些文本大的人使用滚动。 这是我的密码:

<ContentPage.Content>
    <StackLayout>
        <ScrollView>
            <StackLayout Margin="30">
        ... Many controls are here
            </StackLayout>
        </ScrollView>

        <StackLayout 
            x:Name="Validation" 
            HeightRequest="150"
            IsVisible="{Binding ValidationResult.IsValid, Converter={converters:InverseBoolConverter}}">
            <Label Text="Please fix the following errors:" TextColor="Red" Margin="0,0,0,10" />
            <Label Text="{Binding Errors}" TextColor="Red" />
        </StackLayout>

        <Button 
            Text="Calculate"
            Command="{Binding CalculateCommand}"
            Style="{StaticResource ButtonStyle}"
            HorizontalOptions="CenterAndExpand" />

    </StackLayout>
</ContentPage.Content>

... 这里有很多控件
增加:

我没有提到页面内容在ControlTemplate中:

            <ControlTemplate x:Key="MainPageTemplate">
            <Grid>
                <Label Text="{Binding ErrorMessage}" TextColor="Red" />
                <ContentPresenter Margin="10, 0, 10, 120" />
                <StackLayout VerticalOptions="End" BackgroundColor="LightGray" Padding="20" >
                    <Label Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat='© {0:yyyy} Company Name, Inc.'}" />
                    <Label Text="All trademarks shown are the intellectual properties of their respective owners." />
                </StackLayout>
            </Grid>
        </ControlTemplate>

同意@Jason,堆栈布局将不适合其子元素的大小。因此,您可以对三行使用网格

<Grid>

        <Grid.RowDefinitions>

            <RowDefinition Height="0.9*"  />
            <RowDefinition Height="150"  />
            <RowDefinition Height="0.1*"  />

        </Grid.RowDefinitions>

        <ScrollView Grid.Row="0" Orientation="Both">
            <StackLayout Margin="30" BackgroundColor="LightBlue" HeightRequest="300">
              
            </StackLayout>
        </ScrollView>

        <Grid HeightRequest = "150" Grid.Row="1">

          <Grid.RowDefinitions>

            <RowDefinition Height="Auto"  />
            <RowDefinition Height="Auto"  />
        

          </Grid.RowDefinitions>

            <Label  Grid.Row="0"  Text="Please fix the following errors:" TextColor="Red" Margin="0,0,0,10" />
            <Label  Grid.Row="1" Text="{Binding Errors}" TextColor="Red" />
        </Grid>

        <Button 
            Grid.Row="2"
            Text="Calculate"
           
            HorizontalOptions="CenterAndExpand" />


</Grid>


对于最外层的容器,使用网格而不是堆栈布局。或者把按钮放在按钮上方scrollview@Jason谢谢你,杰森。由于你是第一个提出建议的人,你愿意回答吗?谢谢你的回答。我应用了它,但它没有帮助。也许它与控件模板有关?我把它添加到了我的原始问题中。我还在第二行定义中使用了“高度自动”,因为该控件仅在需要时才可见,并且我不能允许有很大的空白。在您的情况下,您需要将第二行的父布局设置为同时包含两行的网格。您能为我澄清一下吗?不幸的是,这不起作用。那里有很大的空白空间,因为