问题描述
在xamarin表单中,我正在使用混合Web视图来显示texarea和输入字段.当我尝试在textarea中输入一些数据时,键盘会弹出并隐藏textarea.
因此,我看不到正在输入的文本,它不会自动滚动到当前光标位置.我已阅读到添加
android:windowSoftInputMode="adjustResize"
到Android清单文件即可解决问题.
但是是否可以将上述属性仅应用于webview(而不应用其他视图)?或者还有其他方法可以自动滚动视图,以便输入字段(光标)位于键盘上方.
请帮助
In xamarin forms I am making use of hybrid webview to display texarea and entry fields.When I try to enter some data inside the textarea the keyboard pops up and hides the textarea.
Thus I am not able to see the text that i'm typing.It does not auto scroll to the current cursor position.I have read that adding
android:windowSoftInputMode="adjustResize"
to the android manifest file does the trick.
But is it possible to apply the above property to only the webview(without applying for other views)?Or is there any other way to auto scroll the view so that entry field(cursor)is just above the keyboard.
Please help
推荐答案
在App.xaml.cs
中,您可以添加:
using AndroidSpecific = Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
public App()
{
InitializeComponent();
AndroidSpecific.Application.SetWindowSoftInputModeAdjust(this, AndroidSpecific.WindowSoftInputModeAdjust.Resize);
…
我想这不像ArtūrasPaleičikas的 answer 惯用,但效果相同.
Which I guess is less idiomatic than Artūras Paleičikas' answer but achieves the same affect.
这篇关于键盘在Xamarin形式的Hybrd Webview中隐藏了Textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!