• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Why applying transformation to webView dislocate touch events inside webView?

Iskuhi

Lurker
I override onDraw() method of WebView and apply only translate() to canvas(then I need to apply skew and scale methods as well.) As a result the WebView is translated,while the touch events are dislocated as much as the WebView is translated.for example: clicking on button it selects text as before transformation it was the location of text.

How could I apply transformation to WebView without having such dislocation of touch events?

Code:
 final WebView mWebView = new WebView(this);
    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setPluginState(WebSettings.PluginState.ON);
    mWebView.loadUrl(url);


   private class CustomWebView extends WebView {
    public CustomWebView(Context context) {
        super(context);
    }

    @Override
    protected void onDraw(Canvas canvas) {
       canvas.translate(200,900);
        super.onDraw(canvas);
    }
}
 
Back
Top Bottom