为什么机器人的WebView拒绝用户输入? [英] Why is Android WebView refusing user input?

查看:90
本文介绍了为什么机器人的WebView拒绝用户输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用web视图来显示的Facebook登录页面的Andr​​oid应用程序。该页面加载漂亮,我能选择的用户名/密码的文本框,但键入他们将无法正常工作。也就是说,他们绝对有输入焦点(他们有橙色的焦点高亮框和一个闪烁的光标),但打字他们也绝对没有什么。我不能肯定,但我认为也许是表单按钮也玩起来 - 他们似乎被简单地刷新页面,而不是提交表单

I'm developing an Android application that uses a WebView to display the login page for Facebook. The page loads beautifully, and I'm able to select the username/password textboxes, but typing in them will not work. That is, they definitely have input focus (they have the orange focus highlight box and a flashing cursor), but typing in them does absolutely nothing. I'm not certain, but I think maybe the form buttons are also playing up - they appear to be simply refreshing the page, rather than submitting the form.

只是要清楚,虽然我在得到Facebook的运行特别感兴趣,我敢肯定,这不是因为其他网站(谷歌等)Facebook的问题,也显示了相同的行为。

Just to be clear, although I'm particularly interested in getting Facebook running, I'm sure that this isn't a Facebook issue since other websites (Google, etc) also display the same behavior.

有没有人有任何想法可能是什么问题?

Does anyone have any ideas what might be the issue?

推荐答案

事实证明,它显然是web视图没有焦点是问题。

Turns out that it was apparently the WebView not having focus that was the issue.

我发现,使用箭头键获得焦点的文本框使他们的工作,所以我的理论,有一个问题的地方的东西,没有重点,很可能不具有的WebView焦点。果然,将下面的行似乎解决的问题:

I discovered that using the arrow keys to get focus on the textboxes caused them to work, so I theorised that there was an issue somewhere with something not having focus, most likely the WebView not having focus. Sure enough, adding the following line seemed to fix the problem:

webView.requestFocus(View.FOCUS_DOWN);

我仍然无法解释究竟为什么首先发生的问题 - 文本框应该他们是否接收焦点来自于或通过被箭头,以被挖掘出来 - 但至少我有一个解决方案,出现工作

I'm still at a loss to explain exactly why the issue occurred in the first place - the textboxes should work whether they receive focus from being tapped upon or through being "arrowed" to - but at least I have a solution that appears to work.

感谢您的输入WF。

这篇关于为什么机器人的WebView拒绝用户输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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