0
我想在使用Google文檔在webview中查看PDF鏈接時隱藏pdf下載和打印選項。有沒有想法實現它。我試過這個。隱藏使用Google文檔的Webview中的PDF打印/下載選項
mWebView.setWebViewClient(new Callback());
String urlEncoded = null;
try {
urlEncoded = URLEncoder.encode(url, "UTF-8");
url = "http://docs.google.com/viewer?url=" + urlEncoded;
Log.d("BrowserACtivity", "doc: "+url);
mWebView.loadUrl(url);
} catch (Exception e) {
Log.d("BrowserActivity", "Exc: "+e.toString());
}
private class Callback extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return(false);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
try {
mWebView.loadUrl("javascript:(function() { " +
"document.getElementsByClassName('ndfHFb-c4YZDc-GSQQnc-LgbsSe ndfHFb-c4YZDc-to915-LgbsSe VIpgJd-TzA9Ye-eEGnhe ndfHFb-c4YZDc-LgbsSe')[0].style.display='none'; })()");
} catch (Exception e) {
Log.d("BrowserActivity", "onPageFinished -- Exc: " + e.toString());
}
}
}
但我無法隱瞞它。你能告訴我任何想法。提前致謝。
是可以共享文檔的URL – jaffar