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.

You may also like to read

DevFestAhm – GDGAhmedabad 2015 – Aweso... Google Developer Group is Open for all including students, newbies, developers and anyone for all who are interested in Google technologies. It is Guj...
Using Firebase Crash Reporting in Android Firebase is a cloud service provider which gives you the tools and infrastructure need to build better apps and grow successful businesses. There a...
Develop apps faster using Data Binding – Par... Google has been pushing updates to existing tools and making the life of android developers easier. They also have been releasing new libraries and AP...
Customizing TextInputLayout – Part 2 In previous article Customizing TextInputLayout - Part 1, we learnt how to customize TextInputLayout and how to apply hint color to it. Going t...
Share on Facebook0Share on Google+2Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on Tumblr0Email this to someone