在webview xamarin表单中单击输入和显示键盘时,页面未滚动
我尝试使用Xamarin表单开发android应用程序。 网络视图中有一个输入。单击该输入时,会显示键盘。但我看不到我写的内容。输入不会向上滚动 XAML和WebViewRenderer的内容如下所示在webview xamarin表单中单击输入和显示键盘时,页面未滚动,xamarin,xamarin.forms,xamarin.android,Xamarin,Xamarin.forms,Xamarin.android,我尝试使用Xamarin表单开发android应用程序。 网络视图中有一个输入。单击该输入时,会显示键盘。但我看不到我写的内容。输入不会向上滚动 XAML和WebViewRenderer的内容如下所示 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="c
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:deneme"
">
<ContentPage.Content>
<ScrollView>
<Grid>
<Grid.ColumnDefinitions>.ColumnDefinitions>
<Grid.RowDefinitions>.RowDefinitions>
<local:HybridWebView x:Name="webView" Grid.Row="0" Grid.ColumnSpan="2">
</local:HybridWebView>
<Button Text="Button1" Grid.Column="0" Grid.Row="1"/>
<Button Text="Button2"/>
<Label Text="Hidden"/>
</Grid>
</ScrollView>
</ContentPage.Content>
查看Android文档,尤其是活动的Android:windowSoftInputMode
()属性。只需将这一行添加到代码中即可
Window.SetSoftInputMode(SoftInput.AdjustPan);
您可以使用文档中描述的
在xaml中:
<Application ...
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:Application.WindowSoftInputModeAdjust="Resize">
...
</Application>
您是否尝试重建?也许可以在Renderer var window=((Activity)Forms.Context.window)中尝试这一点;window.SetSoftInputMode(软输入、调整平移);我添加了Window.SetSoftInputMode(Android.Views.SoftInput.AdjustResize);在MainActivty类中,与您关闭时相同。当显示键盘时,我可以手动滚动页面。但当显示键盘时,我希望自动向上滚动页面。@Mehmet您可以与我共享您使用的url吗?嗨,您解决了吗?你有ios的解决方案吗?ScrollView
和web view结合在一起不是我认为最好的主意。。。
<Application ...
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:Application.WindowSoftInputModeAdjust="Resize">
...
</Application>
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
...
App.Current.On<Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);