【发布时间】:2010-10-13 12:30:58
【问题描述】:
我计划在 webview 中显示 SD 卡中的图像,以利用他内置的 webview 缩放功能。但是,我遇到了显示大于屏幕尺寸(例如 1800x1200)的图像以适应屏幕的问题,例如在 ImageView 中。我希望首先完整显示图像并为用户提供缩放控制。 我尝试使用 WRAP_CONTENT 作为 webview 的宽度和高度,但这不起作用。 有任何想法吗? 以下是我正在使用的代码 sn-p:
String path = getRealPathFromURI(mUriList.get(0)); // this gets the file path
webView = (WebView) findViewById(R.id.WebView01);
WebSettings settings= webView.getSettings();
settings.setBuiltInZoomControls(true);
settings.setSupportZoom(true);
webView.loadUrl("file://" + path);
【问题讨论】: