Why is Android WebView refusing user input?

前端 未结 16 1867
半阙折子戏
半阙折子戏 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:38

    in my context (webview containing an external URL), this fragment works:

        webview.setOnTouchListener(new View.OnTouchListener() {
           @Override
           public boolean onTouch(View v, MotionEvent event) {
               switch (event.getAction()) {
                   case MotionEvent.ACTION_DOWN:
                   case MotionEvent.ACTION_UP:
                       v.requestFocusFromTouch();  
                       break;
               }               
               return false;
           }
    
    });
    

    the error is because at every touch the webview was losing the focus!

提交回复
热议问题