Android: Draw Canvas On Webview
I am using a WebView to display an image that is in my resources, using a WebView because I need it to be zoomable. Dynamically I need to be able to draw points on the image, it is
Solution 1:
In you last line, you are giving it a new canvas (which will not have map.png loaded).
What you should do is:
- Create a new class which extends WebView
override its onDraw() method, like:
publicclassMyWebViewextendsWebView{ @OverrideprotectedvoidonDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawPoint(yourPoint); } }
Make its variable:
MyWebViewmWebView=newMyWebView(this);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.loadUrl("file:///android_res/drawable/map.png");
add this view to your Main View of your layout.
myMainView.add(wv);
Done!
Post a Comment for "Android: Draw Canvas On Webview"