android imageView: setting drag and pinch zoom parameters

前端 未结 7 1844
太阳男子
太阳男子 2020-11-27 14:06

I am currently developing for Android (my first app) an application which lets users see the subway map and be able to pinch zoom and drag around.

I am currently mod

7条回答
  •  借酒劲吻你
    2020-11-27 14:42

    Another option that might work for some is to use a WebView, which has built in zoom controls.

    WebView webView = new WebView(this);
    webView.setBackgroundColor(0xff000000);
    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setSupportZoom(true);
    //webView.getSettings().setDisplayZoomControls(false);  // API 11
    webView.loadDataWithBaseURL(null, getHtml(), "text/html", "UTF-8", null);
    mainView.addView(webView, -1, -2);
    

提交回复
热议问题