- I want to make 4 different border clicks of an imageview.
- also, border should be strechable with imageview.
- How can i differentiate four corner's click with placing drawable also ?
Asked
Active
Viewed 164 times
3
-
How does this relate to OpenCV? – Bull Aug 27 '13 at 14:00
-
@B...Somewhere i heard about it. I dont have idea. Guide me How can i do this ? – Jack 1990 Aug 27 '13 at 14:02
-
check this link: http://stackoverflow.com/q/17671558/1567588 – SKK Aug 27 '13 at 14:11
1 Answers
2
You are going to need to make a custom view and Override onDraw().
First, use canvas.drawBitmap() to get the image to show up.
Second, use canvas.drawRect() 4 times to get each of your corner buttons. (You'll have to get the left, top, right, bottom from your bitmap to get the coordinates for your 4 rects)
Third, Override onTouch() to intercept the XY touch coordinates
Fourth, use the intercepted touch coordinates in myRect.contains(x,y) to find out if your rect was touched. Then you can complete any action you need when the rect it touched
Hope this helps.

Kent Andersen
- 2,151
- 3
- 21
- 29