Scrollview 在 Xamarin Forms 中不工作

Scrollview is not working in Xamarin Forms

我的 xamarin 表单应用程序中有以下布局:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
             xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
             x:Class="DMGMobile.UserDetailPage">
    <ContentPage.ToolbarItems>
        <ToolbarItem Name="Save" Icon="settings.png" Clicked="Save"></ToolbarItem>
    </ContentPage.ToolbarItems>

    <ContentPage.Content>
        <ScrollView 
            Orientation="Vertical" 
            VerticalScrollBarVisibility="Always"
            VerticalOptions="FillAndExpand">
            <StackLayout
                VerticalOptions="FillAndExpand"
                Padding="10,0,10,0">

                <Label 
                    Text="Name"/>
                <telerikInput:RadEntry 
                    x:Name="User_Name"
                    BackgroundColor="White" 
                    WatermarkText="Name"
                    TextColor="Black"
                    WatermarkTextColor="#C0C0C0">
                    <telerikInput:RadEntry.Padding>
                        <OnPlatform x:TypeArguments="Thickness">
                            <On Platform="Android,UWP" Value="10,10,0,10" />
                            <On Platform="iOS" Value="10,10,0,20" />
                        </OnPlatform>
                    </telerikInput:RadEntry.Padding>
                    <telerikInput:RadEntry.BorderStyle>
                        <telerikInput:BorderStyle 
                            CornerRadius="8"
                            BorderColor="#257cc1"
                            BorderThickness="1" />
                    </telerikInput:RadEntry.BorderStyle>
                </telerikInput:RadEntry>

                <Label 
                    Text="Surname"/>
                <telerikInput:RadEntry 
                    x:Name="User_Vorname"
                    BackgroundColor="White" 
                    WatermarkText="Surname"
                    TextColor="Black"
                    WatermarkTextColor="#C0C0C0">
                    <telerikInput:RadEntry.Padding>
                        <OnPlatform x:TypeArguments="Thickness">
                            <On Platform="Android,UWP" Value="10,10,0,10" />
                            <On Platform="iOS" Value="10,10,0,20" />
                        </OnPlatform>
                    </telerikInput:RadEntry.Padding>
                    <telerikInput:RadEntry.BorderStyle>
                        <telerikInput:BorderStyle 
                        CornerRadius="8"
                        BorderColor="#257cc1"
                        BorderThickness="1" />
                    </telerikInput:RadEntry.BorderStyle>
                </telerikInput:RadEntry>

                <Label 
                    Text="Login"/>
                <telerikInput:RadEntry 
                    x:Name="User_Login"
                    BackgroundColor="White" 
                    WatermarkText="Login"
                    TextColor="Black"
                    WatermarkTextColor="#C0C0C0"
                    TextChanged="User_Login_TextChanged">
                    <telerikInput:RadEntry.Padding>
                        <OnPlatform x:TypeArguments="Thickness">
                            <On Platform="Android,UWP" Value="10,10,0,10" />
                            <On Platform="iOS" Value="10,10,0,20" />
                        </OnPlatform>
                    </telerikInput:RadEntry.Padding>
                    <telerikInput:RadEntry.BorderStyle>
                        <telerikInput:BorderStyle 
                        CornerRadius="8"
                        BorderColor="#257cc1"
                        BorderThickness="1" />
                    </telerikInput:RadEntry.BorderStyle>
                </telerikInput:RadEntry>

                <Label 
                    Text="Pass"/>
                <telerikInput:RadEntry 
                    x:Name="User_Password"
                    BackgroundColor="Transparent" 
                    WatermarkText="Pass"
                    TextColor="Black"
                    WatermarkTextColor="#C0C0C0"
                    TextChanged="User_Login_TextChanged">
                    <telerikInput:RadEntry.Padding>
                        <OnPlatform x:TypeArguments="Thickness">
                            <On Platform="Android,UWP" Value="10,10,0,10" />
                            <On Platform="iOS" Value="10,10,0,20" />
                        </OnPlatform>
                    </telerikInput:RadEntry.Padding>
                    <telerikInput:RadEntry.BorderStyle>
                        <telerikInput:BorderStyle 
                        CornerRadius="8"
                        BorderColor="#257cc1"
                        BorderThickness="1" />
                    </telerikInput:RadEntry.BorderStyle>
                </telerikInput:RadEntry>

                <telerikPrimitives:RadCheckBox 
                    x:Name="User_IsAdmin" />
                <Label 
                    Text="Is admin}"/>

            </StackLayout>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>

问题是 ScrollView 不工作。尽管 VerticalScrollBarVisibility 设置为 Always,但我什至看不到垂直滚动条。 没有键盘的页面看起来不错,但如果显示键盘,则页面底部的一些输入将被隐藏,我无法滚动找到它们。

我是不是漏掉了什么令人讨厌的东西?

如果你使用的是Android,你可以在MainActivity中的LoadApplication之后添加:

Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);