draw dynamic rectangles with images in android
I have a problem that I want to draw rectangles dynamically on the Android Screen with clickable images inside them.
I don't开发者_StackOverflow社区 know how to achieve this. Please Help me out about this problem.
Thanks in advance.
extends any view like View, ImageView, or any Layout and set into the activity like we set as contentview
for e.g.
class MyView extends View{
..........
}
now in this class override the onTouch and draw method
- In onTouch get the event for touch, move, etc.
- set the flag for the event and get the co-ordinate of screen in touch event.
- store into the private member for starting position and moving/end position co-ordinate
- draw the rectangle using this co-ordinate
Look up Imageview and onClickListener.
精彩评论