Question

I have a layout in which I am displaying a webview. I want to add images on top of the webview at specific places through code.

Can some one please tell me how to do that?

The translucent background example in API Demos makes the view cover the whole screen. I want to place only a small image and at a specific location (origin not 0,0)

Thanks a lot.

Was it helpful?

Solution

Have you tried putting both the WebView and the ImageView inside an Absolute Layout? This should let you specify the X/Y location of your image and by ordering make it constantly drawn over the webview.

EDIT: check out the Absolute layout: http://developer.android.com/guide/topics/ui/layout-objects.html#absolutelayout

OTHER TIPS

AbsoluteLayout is deprecated and if that bothers you, you may want to look for alternative. I have put an example in my blog post here. It might not be exactly what you are after, but should give you an idea:

http://anothermobiledeveloper.blogspot.com/2011/10/using-relativelayout-instead-of.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top