I have a URL where User can Input in a Field.
When I open that URL with the Android Browser and click in the Field the Virtual Keyboard pops up. When I open the same URL with my WebView and click in the Field the Virtual Keyboard does NOT appear?!
What Do I have to do? my code is below
LayoutInflater factory = LayoutInflater.from(InviteFriends.this); textEntryView = factory.inflate(R.layout.link, null);
        builder = new AlertDialog.Builder(InviteFriends.this);
        builder.setTitle("Web view");
        builder.setView(textEntryView);
        wvLink = (WebView) textEntryView.findViewById(R.id.wv);
        wvLink.getSettings().setJavaScriptEnabled(true);
        wvLink.loadUrl("http://www.google.com");
        wvLink.requestFocus(View.FOCUS_DOWN);
        wvLink.setWebViewClient(new WebViewClient() 
        {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) 
            {
                view.loadUrl(url);
                return true;
          开发者_如何学编程  }
        });
        builder.setNegativeButton("oK",
                new DialogInterface.OnClickListener() {
                    public void onClick(
                            DialogInterface dialog,
                            int which) { 
                        try {
                            if (type == 0) {
                              }
                        } catch (Exception e)
                            {
                                e.printStackTrace();
                            }
                    }
                });
        alert = builder.create();
        alert.show();
Thanks in advance
So if I understand correctly, you are showing that webpage in an AlertDialog, right? Well, I just had that problem a few days ago, and in the end I solved it by creating a custom Dialog. Custom Dialog is not affected by the WebView bug, and the AlertDialog is. So your solution would look sth like this:
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialog);
dialog.setTitle("Web view");
dialog.setCancelable(true);
dialog.show();
WebView vw = (WebView) dialog.findViewById(R.id.wv);
You would also need to define layout for the dialog with a WebView and a Button inside.
This may be the same problem discussed at WebView textarea doesn't pop up the keyboard
The solution appears to be :
The problem was that webview wasn't getting focus when it was loaded hence using
webView.requestFocus(View.FOCUS_DOWN);solved the prblem.
Hope this helps,
Phil Lello
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论