1

私は Webview を使用して、ズームをサポートするローカル画像を見ています。現在のコードのように幅ではなく、画像の高さに合わせて WebView をズームする方法はありますか? ここに私が持っているものがあります:

WebView image = (WebView)findViewById(R.id.map);
    image.getSettings().setBuiltInZoomControls(true);
    image.getSettings().setLoadWithOverviewMode(true);
    image.getSettings().setUseWideViewPort(true);
    image.setLayoutParams(new     LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT));
    image.loadUrl("file:///android_asset/image.png");
4

1 に答える 1

2

webView設定を使用してみてください

webSettingsクラスを使用する

webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);

Webviewのズームの設定を確認してください

更新:setDefaultZoom非推奨 として、別の設定を使用する必要があります

于 2012-06-07T19:46:53.633 に答える