我想使用WebView和Google Docs网址制作PDF查看器。 但是,由于某些原因,当它到达第二页并且连续时它没有正确显示,除了在Android 5上。
以下是Android 4.1.1中的图片: http://oi57.tinypic.com/6rrbpy.jpg
其他来自Android 5.0.0: http://oi62.tinypic.com/2vdlefm.jpg
知道为什么会这样吗? 这是我的代码
public class PDFViewer extends Activity {
public void onCreate(Bundle savedInstanceState){
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
this.setContentView(R.layout.web_viewer);
WebView myWebView = (WebView) this.findViewById(R.id.webViewSimple);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
if (progressDialog == null) {
progressDialog = new ProgressDialog(PDFViewer.this);
progressDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
progressDialog.setMessage("Loading...");
progressDialog.show();
}
}
public void onPageFinished(WebView view, String url) {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}
});
String link=getIntent().getExtras().getString("link");
myWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+link);
}