Xamarin.Forms:软键盘与页面底部的最后一个条目(滚动时)重叠

E75*_*E75 0 listview android-softkeyboard xamarin.forms

[Xamarin.Forms 2.5.0.91635] [Android 5,6,7,8]

我有一个页面,其中包含一个包含输入条目和标签的列表视图.我的问题是在Android中,点击第一个或第二个条目时,会出现键盘.我希望它向下滚动页面以选择最后一个条目,但我无法看到(或聚焦)最后一个条目,因为它与软键盘重叠.当软键盘启用/可见时,我无法滚动到最后一个条目,因为软键盘隐藏了最后一个键盘.当我隐藏/禁用软键盘时,我可以滚动到最后一个条目,但我不想要这个!

我在互联网上搜索并尝试了很多,但没有任何作用.

解决方案没有奏效: https://gist.github.com/jimmgarrido/e36033b26f01e8da091fd321d41d991a xamarinformscorner.blogspot.nl/2016/06/soft-keyboard-hiding-entries-fields-in.html HTTPS://forums.xamarin .COM /讨论/ 62668 /程序兼容性-不-不调整大小,屏幕与键盘

<ContentPage.Content>
        <ScrollView>
                <StackLayout x:Name="StackLayoutButtons" HorizontalOptions="Center" Orientation="Horizontal">
                    <Button x:Name="PreviousButton" WidthRequest="35" FontSize="23" FontAttributes="Bold" Clicked="PreviousButton_OnClicked"></Button>
                    <Button x:Name="DatePickerButton" FontSize="20" Clicked="DatePickerButton_OnClicked"></Button>
                    <DatePicker x:Name="DatePicker" Format="dddd d MMMM yyyy" VerticalOptions="Center" HorizontalOptions="FillAndExpand" IsVisible="False" IsEnabled="False"/>
                    <Button x:Name="NextButton" WidthRequest="35" FontSize="23" FontAttributes="Bold" Clicked="NextButton_OnClicked"></Button>
                    <Button x:Name="LastButton" WidthRequest="50" FontSize="23" FontAttributes="Bold" Clicked="LastButton_OnClicked"></Button>
                </StackLayout>

                <ListView x:Name="ListViewItemPage" ItemTapped="ListView_OnItemTapped">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <RelativeLayout x:Name="RelativeLayout" >
                                    <Label x:Name="DescriptionLabel" Text="{Binding Description}"  RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=15}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=0, Constant=15}" />
                                    <Entry x:Name="Entry" WidthRequest="85" Keyboard="Text" HorizontalTextAlignment="Start" FontSize="19" HorizontalOptions="Center" VerticalOptions="Center" Text="{Binding Value, Mode=TwoWay, Converter={StaticResource FloatValueConverter}}" Unfocused="ValueEntry_OnUnfocused"
                                           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=10}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant={StaticResource ConstantMultiPlatform}}" >
                                        <Entry.HeightRequest>
                                            <OnPlatform x:TypeArguments="x:Double">
                                                <On Platform="iOS" Value="28"></On>
                                                <On Platform="Android" Value="42"></On>
                                                <On Platform="UWP" Value="32"></On>
                                            </OnPlatform>
                                        </Entry.HeightRequest>
                                    </Entry>
                                </RelativeLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>
        </ScrollView>
    </ContentPage.Content>
Run Code Online (Sandbox Code Playgroud)

普通视图(最后一个条目) 当第一个条目聚焦并一直向下滚动时

也许这里的某个人有这个bug的工作解决方案/解决方法?

Mal*_*kuS 5

这是一个众所周知的问题,由于Xamarin Forms上的错误而发生.

将WindowSoftInputMode属性设置为活动本身并不完全正常,因为这个bug必须通过在下面添加这行代码来显式设置此属性.

LoadApplication(new App());

电话:

Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
Run Code Online (Sandbox Code Playgroud)