Draw view on Image within xml

后端 未结 2 521
后悔当初
后悔当初 2021-01-22 18:47

can you help me by sharing your knowledge on how to draw a small rectangle on top of image in android. I have main.xml and there are some widgets. right at top, there is a imag

相关标签:
2条回答
  • 2021-01-22 18:55

    Don't use the standard ImageView for that. Create your own class extending View. Then override the draw() method. There you can display the image and do all the stuff you want including drawing the rectangle.

    0 讨论(0)
  • 2021-01-22 19:09

    You can use ImageView... I've actually done just that in one of my apps. Then you can override the OnDraw() method, which passes in a Canvas you can use to draw on...

    I used this as a reference: Draw onto an ImageView

    0 讨论(0)
提交回复
热议问题