键盘在Xamarin形式的Hybrd Webview中隐藏了Textarea [英] Keyboard hides Textarea inside a Hybrd Webview in Xamarin forms

查看:156
本文介绍了键盘在Xamarin形式的Hybrd Webview中隐藏了Textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆