0

我在 spring mvc 上有一个聊天 Web 应用程序。我使用 android webview 进入使用 websockets 的聊天页面。我可以在 android webview 上看到该页面,但是当我键入并单击发送时它没有响应。当我使用码头将其部署在浏览器上时,此页面工作正常。

        webview= (WebView)findViewById(R.id.webscreen);
        webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);              
        webview.getSettings().setSupportMultipleWindows(false);
        webview.getSettings().setSupportZoom(false);       
        webview.setVerticalScrollBarEnabled(true);
        webview.setHorizontalScrollBarEnabled(false);
        webview.setClickable(true);
        webview.setLongClickable(true);        
        webview.setBackgroundColor(0);
        webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webview.getSettings().setLightTouchEnabled(true);     
        webview.loadUrl("http://10.0.2.2:8080/mychat/chatwindow");
        webview.setWebViewClient(new DroidWebViewClient());
4

1 回答 1

0

如果你在网上四处看看,你会看到很多关于Android 网络浏览器不支持套接字的信息。WebView没有什么不同。

于 2012-06-05T17:27:10.600 回答