开发者

Android webview multitouch zoom not work in HVGA

开发者 https://www.devze.com 2023-02-06 04:23 出处:网络
On galaxy S the zoom controls work on multitouch, but on HTC Legend, t开发者_如何学Che same code doesnt work. What is the matter?There is something going on with the HTC legend and multitouch. see thi

On galaxy S the zoom controls work on multitouch, but on HTC Legend, t开发者_如何学Che same code doesnt work. What is the matter?


There is something going on with the HTC legend and multitouch. see this -i agree, rather messy- link: http://www.htclegendforum.com/htc-legend-general-discussion/only-%27pinch-to-zoom%27-no-tual-touch-no-multi-touch/

As I understand it, the HTC legend supports only 'pinch to zoom', not real multitouch.


Htc has done some changes in their webview implementation and that requires to call some API to make pinch to zoom working on those phones. Try following:

_webView.getSettings().setBuiltInZoomControls(true);
        try {
            Method m = _webView.getClass().getMethod("enableMultiTouch",
                    null);
            if (m != null) {
                m.invoke(_webView, null);
            }
        } catch (Exception e) {
            //e.printStackTrace();
        }

        try {
            Method m = _webView.getClass().getMethod(
                    "enableMultiTouchTextRelow", boolean.class);
            if (m != null) {
                m.invoke(_webView, false);
            }
        } catch (Exception e) {
            //e.printStackTrace();
        }
        try {

            Method m = _webView.getClass().getMethod(
                    "setIsCacheDrawBitmap", boolean.class);
            if (m != null) {
                m.invoke(_webView, false);
            }
        } catch (Exception e) {
            // e.printStackTrace();
        }

        // Must for HTC EVO to do text reflow after double tap
        try {
            Method m = _webView.getClass().getMethod("enableSmartZoom",
                    null);
            if (m != null) {
                m.invoke(_webView, null);
            }
        } catch (Exception e) {
            // e.printStackTrace();
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消