In an struggle to fix something in drawing of Webkit engine I ended up
with this code to change the canvas to my canvas on the draw method:


class MyWebView extends WebView {

        public MyWebView(Context context) {
                super(context);
                // TODO Auto-generated constructor stub
        }

        protected void onDraw (Canvas canvas) {
                //MyCanvas c = new MyCanvas(canvas);

                Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(),
canvas.getHeight(),
                                Bitmap.Config.ARGB_8888);

                MyCanvas m = new MyCanvas(bitmap);

                m.setMatrix(canvas.getMatrix());

                super.onDraw(m);

                Rect r = canvas.getClipBounds();
                canvas.drawBitmap(bitmap, r.left, r.top, null);
                canvas.drawText("MyPageVersion", r.left+20, r.top+20, new 
Paint());

        }

}


MyCanvas is extended Canvas and override almost all functions (all
drawing functions) but none of the will call by the OnDraw method of
WebView.

I've chased the chain of method calls and reached native methods and
my only explanation is android Native codes to not respect method
overriding and call the original version of methods in Canvas.

Anybody nows anything about this issue?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to