[英]how to know when and where a textfield is focused in an android webview?
Normally when a native textfield in an android view is focused, the view scrolls automatically to keep the field visible when the virtual keyboard appears. 通常,当对android视图中的本机文本字段进行聚焦时,当虚拟键盘出现时,视图会自动滚动以使该字段可见。 And it's normally the same behaviour when I select a textfield in a webview (so I mean a html text input in the page that loaded in the webview).
当我在Web视图中选择文本字段时,通常是相同的行为(因此,我的意思是在Web视图中加载的页面中输入html文本)。 But for some reason, it doesn't work in my case.
但是出于某种原因,在我的情况下它不起作用。 I have a webview that displays a form and when a select a textfield, the view scrolls down to the bottom of the page and the field I selected is no longer visible.
我有一个显示表单的Web视图,当选择一个文本字段时,该视图向下滚动到页面底部,并且我选择的字段不再可见。 What should I check in my app to prevent this to happen?
我应该在我的应用程序中进行哪些检查以防止这种情况发生? If you need more details, just ask.
如果您需要更多详细信息,请询问。 In this way I can show you directly what you need.
这样,我可以直接向您显示您的需求。 Thanks in advance.
提前致谢。
EDIT: on android 4, this is not happening. 编辑:在android 4上,这没有发生。 I encountered the problem on android 2.2 and 2.3.
我在android 2.2和2.3上遇到了问题。
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode =“ adjustResize”
Add above tag in your manifest file's activity tag. 在清单文件的活动标签中添加上述标签。 The activity will be the one which displays webview
该活动将是显示webview的活动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.