I want to crop my image which is being displayed on an ImageView
. How I want to go about it is that I want a re-sizable rectangle to be displayed on the image. That rectangle will have moveable corners (which I can drag around with touch) to increase/decrease its size.
The image below illustrates a demo of something I would like to develop.
Asked
Active
Viewed 4,545 times
4
-
can you be more specific on your problem you are facing? – senola Oct 19 '11 at 07:49
-
just have a look at the url and i want to create the same – Nagendra Oct 19 '11 at 09:36
-
Did you find the solution? Even I am in need of a similar thing, please help! – Antrromet Oct 23 '12 at 12:49
-
@user869133.. Did you find the solution? Did you implement this? Could anyone please tell me on how to implement the above feature? – Bharath Jul 25 '13 at 09:35
1 Answers
1
As your question is very vague here is some general approach to solve this by creating an own View. I would suggest you extend the Androids ImageView with your own class.
Within this class you can use the
public void draw(Canvas canvas)
method to draw additional elements like a rectangular or circles for the corners (don't forget to call super.draw so that the image is also drawn.
Furthermore, you have to intercept the UI events on that view to decide if a corner was moved by the user. See http://developer.android.com/guide/topics/ui/ui-events.html for more details on that.
Within your layout you can add this view just by an XML tag with your package and view class as tag name. e.g.:
<com.example.MyCustomView android:layout_height="fill_parent" android:layout_width="fill_parent" android:src="@drawable/myImage"/>

senola
- 782
- 4
- 12
-
I want to draw an image as a background then draw a rectangle on the image, we know the rectangle have four fixed points, when i drag one of these the rectangle can scale – Nagendra Oct 20 '11 at 05:52