Xamarin形式:带有键盘的ScrollView

tot*_*z09 3 c# scrollview xamarin

我使用的是Xamarin Forms的最新版本。我有一个内容页面。内容页面具有一个网格,该网格具有一个滚动视图,该滚动视图的堆栈布局包含一些图像和Entry输入以及一些Button。当我触摸“输入”以输入文本时,键盘覆盖了“按钮”,因此无法按按钮。这是不可滚动的,我也不知道为什么。有人可以帮助我吗?

这是我的XAML代码:

<?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="Spirocco.LoginPage">
<Grid>
    <ScrollView Orientation="Both" x:Name="scrollView">
        <ScrollView.Content>
            <StackLayout BackgroundColor="#302138">
                <Image Source="login_logo" Margin="0,0,0,0"></Image>
                <StackLayout BackgroundColor="White" Margin="20,0,20,30">
                    <Label Text="ÜDVÖZÖLJÜK!" FontSize="30" FontFamily="Comic Sans MS" Margin="0,15,0,0" TextColor="#302138" HorizontalTextAlignment="Center"></Label>
                    <Entry Text="{Binding Email}" Placeholder="E-mail" Margin="40,0,40,0" Keyboard="Email"/>
                    <Entry Text="{Binding Password}" Placeholder="Jelszó" IsPassword="True" Margin="40,0,40,0"/>
                    <Button Text="BEJELENTKEZÉS" Clicked="Login" TextColor="White" BackgroundColor="#302138" Margin="40,10,40,0"/>
                    <Button Text="REGISZTRÁCIÓ" Clicked="Register" TextColor="White" BackgroundColor="#302138" Margin="40,0,40,25"/>
                </StackLayout>
            </StackLayout>
        </ScrollView.Content>
    </ScrollView>
</Grid>
Run Code Online (Sandbox Code Playgroud)

这是解决方案

Pet*_*sky 7

只需将此代码添加到App.xaml.cs,即可自动调整页面大小

using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;

public partial class App : Xamarin.Forms.Application
{
    public App ()
    {
        Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
        InitializeComponent();

        MainPage = new NavigationPage(new LoginTabsPage()){
        ...
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明