1

当用户关注 Xamarin.Form 键盘中的条目控件打开但查看滚动时,设计看起来很丑。所以请帮助我。我已经把图像在 android 设备中打开键盘时如何显示屏幕。我在下面给出的代码

<StackLayout Grid.Row="1">
        <StackLayout Padding="20,10,20,20" >
            <Entry x:Name="Txtusername" Placeholder="Name"/>
            <Entry x:Name="TxtPass"
                   IsPassword="True"
                   Placeholder="Password" />
            <StackLayout Padding="0,10">
                <Button x:Name="BtnSign"
                        BackgroundColor="#FFFFCB04"
                        BorderColor="#FFFFCB04"
                        Clicked="BtnSignInClicked"
                        Text="Sign In"
                        TextColor="Black" />
            </StackLayout>
        </StackLayout>
    </StackLayout>

键盘打开前

打开键盘后

4

1 回答 1

0

从 FormsApplication 开始的地方添加WindowSoftInputMode=SoftInput.AdjustPan您的 MainActivity 类。[Activity()]

这样您的布局不会在键盘处于活动状态时发生变化。我想你不需要在这里滚动。如果要滚动,请在代码中添加滚动视图

<ScrollView>
.//your grid 
.
    <StackLayout Grid.Row="1">
        <StackLayout Padding="20,10,20,20" >
            <Entry x:Name="Txtusername" Placeholder="Name"/>
            <Entry x:Name="TxtPass"
                   IsPassword="True"
                   Placeholder="Password" />
            <StackLayout Padding="0,10">
                <Button x:Name="BtnSign"
                        BackgroundColor="#FFFFCB04"
                        BorderColor="#FFFFCB04"
                        Clicked="BtnSignInClicked"
                        Text="Sign In"
                        TextColor="Black" />
            </StackLayout>
        </StackLayout>
    </StackLayout>
</ScrollView>
于 2016-06-10T11:57:41.743 回答