.pdf リンクを持つ WebView に URL を読み込もうとしています。リンクが JELLY_BEAN デバイスに表示されない [4.1、4.1.1、および 4.2 でテスト済み] ただし、リンクはすべての KITKAT 以降のデバイスで表示されます。
コードは次のとおりです。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.directory_browser);
webView = (ExtendedWebView) findViewById(R.id.webBrowser);
webSettings = webView.getSettings();
progressBar = (ProgressBar) findViewById(R.id.browserProgressBar);
progressTextView = (TextView) findViewById(R.id.browserProgressText);
preparewebView();
webView.loadUrl(getIntent().getStringExtra("medicalUrl"));
}
private void preparewebView() {
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setAllowFileAccess(true);
webSettings.setDomStorageEnabled(true);
webView.requestFocusFromTouch();
webView.setInitialScale(getResources().getInteger(R.integer.medical_webview_initialScale));
webSettings.setBuiltInZoomControls(false);
webView.setPadding(0, 0, 0, 0);
webView.getSettings().setTextZoom(100);
webView.getSettings().setRenderPriority(RenderPriority.HIGH);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
//Decide whether to set a download listener
String prefix = com.theteamie.android.uwc.Webservice.URL.getUwcseaWebappDownloadUrl();
if (!url.startsWith(prefix)){
Log.v("WebViewClient", "Appending downloader");
view.setDownloadListener(new Downloader());
}
super.onPageStarted(view, url, favicon);
}
});
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different
// scales.
// The progress meter will automatically disappear when we
// reach 100%
try {
String progressText = getResources().getString(R.string.loading) + "... ";
if (progress != 100) {
progressBar.setVisibility(ProgressBar.VISIBLE);
progressBar.setProgress(progress);
progressTextView.setVisibility(TextView.VISIBLE);
progressTextView.setText(progressText + Integer.toString(progress));
} else {
progressBar.setVisibility(ProgressBar.GONE);
progressTextView.setVisibility(TextView.GONE);
}
} catch (IllegalStateException e) {
Log.e(TAG, Log.getStackTraceString(e));
}
}
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
}
});
}
それらのデバイスの WebView でリンクが表示されない理由の可能性がある提案。ありがとう