Why is Android WebView refusing user input?

前端 未结 16 1864
半阙折子戏
半阙折子戏 2020-11-28 08:12

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

16条回答
  •  旧巷少年郎
    2020-11-28 08:37

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

    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.

    Thanks for your input wf.

提交回复
热议问题