説明されている方法を使用して、Google の +1 ボタンを WebView に配置しようとしました。次のように WebView を初期化しました。
final WebView web = (WebView)findViewById(R.id.webView);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setSavePassword(false);
web.getSettings().setBuiltInZoomControls(false);
web.getSettings().setUseWideViewPort(true);
web.getSettings().setLoadWithOverviewMode(true);
web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
web.setHorizontalScrollBarEnabled(false);
web.setBackgroundColor(0xff2e2e2e);
web.loadDataWithBaseURL(null, htmlCodeGoesHere, "text/html", "utf-8", null);
そしてhtmlコード:
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<g:plusone href="http://stackoverflow.com"></g:plusone>
問題は... ボタンがまったく表示されないことです。
どうすれば修正できますか?ちなみに、WebViewを使用する代わりに、ボタンで新しいウィンドウを起動することも必要です。簡単な解決策はありますか?
ありがとう