Resizable Rectangle Overlay on Touch in Android

When I read this question http://stackoverflow.com/questions/8974088/how-to-create-a-resizable-rectangle-with-user-touch-events-on-android on StackOverFlow, I tried to develop a custom control overlay which behaves like it.

Read this article to make your own resizable rectangle overlay on touch in Android. This will help you in Image or map application.

 

rectangle overlay

Download Source : https://github.com/rathodchintan/rectangle-overlay

Step 1

Create a package called “customview” in your application and paste following class in it.

Below class holds image, points (location) of 4 corners.

Step 2

We have created a class which holds corners information and image. But to handle those corners, we need to implement that ColorBall objects in another class called “DrawView”. Copy/Paste below code in same package “customview”.

Thats it!!!

To use custom control in your application, write following code in your layout file.

You can do some more research and implementation to add more functionality to this overlay.

Share on Facebook1Share on Google+0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on Tumblr0Email this to someone
  • Zain Zainu

    click on the ball .ball goes to down how fix it

  • mobeen javed

    hello Chintann,, jab bal pe click karty ha to ball nichy q chali jati ha??
    is ka solution bta do Thanks in advance

    • Yes, it is known issue. Require to polish logic as above is simple logic to show rectangle. If you have improved logic, you can share with me, i will update above one. 🙂

  • mobeen javed

    Please reply