开发者

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

  1. In onTouch get the event for touch, move, etc.
  2. set the flag for the event and get the co-ordinate of screen in touch event.
  3. store into the private member for starting position and moving/end position co-ordinate
  4. draw the rectangle using this co-ordinate


Look up Imageview and onClickListener.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜