I studied the Androidreference for hours now, but don't really get the clue how to draw something (Text, Bitmap, Path ....) on a ImageView.
Should I extend View and use the onDraw()
-Method? If yes, how can I draw on my ImageView?
Or is there any other way to achieve my goal?
If you just want to draw another bitmap on your ImageView and it shouldn't be dynamic, than use AbsoluteLayout and position them above each other.
If it should be much more dynamic, I recommend to use a SurfaceView. A tutorial can be found here: http://www.droidnova.com/playing-with-graphics-in-android-part-i,147.html
(currently only online via webarchive: http://web.archive.org/web/20121005111921/http://www.droidnova.com/2d-tutorial-series)
SurfaceView
is what you want. It will give you aCanvas
object, onto which you can draw, usingcanvas.drawCircle(...)
,canvas.drawText(...)
,canvas.drawBitamp(...)
.Yes, you can use the onDraw method. There is a Canvas object passed into that method that you will use to draw on the view. Here is an example of how to do it... taken from the Zebra Crossing barcode scanner application. It is the view that displays the dark outer box, red scanner line, and yellow scan result dots.