Create draggable edge point on imageView - android

I want to create a resize feature of my application but I cannot find a sample implementation of it. Many tutorials offers pinch to zoom.
My problem now is how to implement draggable edges to resize the image just like in ordinary image editor. Do you have any idea how to do this? Just like putting circles/points on the 4 corners of the ImageView like the sample image below.
Is it possible to use the crop library of android to have draggable image?

You can draw the control point, and handle all festure in this point
last month i develop a Android handwritting note app. In this app, i inherit View, and control View.onDraw directly. I draw the image and all control indicator in onDraw, and handle screen touch within the scope of the screen.
This app isn't accomplished, it become a opensource project, you can see the source at https://bitbucket.org/gd920129/white-board/

Related

Android making scale (ruler) on screen

In my application I want to create a ruler to measure length. I have gone through some ruler application in google store. I want to achieve somewhat as shown in the picture.
So my question is how do I draw this marking as per users mobile screen configuration. Is it using using some drawable image or some drawing on canvas.
I am new to android development. Also that the ruler when dragged downward marking and numbering move. So how to achieve that thing.
These kind of things that requires programmatical access to the data is mostly done using 'drawing to the canvas', which in this case is a window spawned by a service.
You should look into overlay activity implementations such as bubbles for android, which lets you peek into the way this is usually achieved, which is by creating a service that adds a window to the system that draws this, from there you can get the screen details, width and height to draw the ruler with.
Inside the spawned window you can add your own subclass of a view that implements the onDraw method in such a way that the ruler is drawn on the canvas.

android ImageView vs canvas for game

I´m new in android development. I want to create a game where the user needs to quickly drag and drop balls with the finger in the screen to specific locations in order to win.
I don´t know if i can do this with simple ImageViews or i need to use canvas or other thing to draw in the screen.
I have tried to drag and drop an ImageView on top of another ImageView but it does not seem to work very well and i'm hesitating if i need to do it drawing figures instead of using the ImageViews or to do something else.
Please advice. Any help is apreciated. Thank you.
ImageViews are Views designed to hold image drawables, which isn't really needed in your case - you can use a simple View with a color background or implemended onDraw method, you can use an ImageView just as well.
Asfor the drag and drop, what you need is any View with implemented onTouch method so that the view changes its position on screen with ACTION_MOVE touch events.
If you're interested, i have implemented a simple frame layout with drag and drop functionality. My layout requires long-click to start drag, but it can be easily modified so it won't. Check it out at my github page. You can clone the project and run demo activity to see how it works, and start from there.

How to show a map which is a big image?

I got a png image which is 5000x5000. This image is some sort of map. I wanted to display the image in an imageview and this gave me an outOfMemoryException(of course). So i tried to set a sampleSize, but this decreased the resolution which makes the map not very usefull.
So basically I want to show this image and be able to zoom and scroll without resolution loses. What would be the best approach?
I am a fan of Dave Morrissey's SubsamplingScaleImageView, which seems to cover what you want. Quoting the project documentation, it is:
A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) without OutOfMemoryErrors. Includes pinch to zoom, panning, rotation and animation support, and allows easy extension so you can add your own overlays and touch event detection.

android crop/save image after zoom and drag

in my application I want to have a frame (with a hole in the middle) and an image under it. I want to be able to drag and zoom the image to fit (the face in the picture) it in the frame. Then Crop the image (could I find the pixel x,y that are in the border of the screen?) and then save the zoomed image so that I can put the frame over it then.
Any suggestions? If possible please tell me the classes I will have to use.
Thanks!!
It is possible to do all the functionalities (What you have discussed above) using Android View class with onDraw method and canvas Object.
Refer the link:
http://developer.android.com/reference/android/graphics/Canvas.html

Android - selecting tile in gameboard by touch?

i am developing checkers application for Android. I have drawn on Canvas gameboard and tiles for each side, also I have made selection of tiles by D-Pad. But what about, Android phone doesn't have D-Pad? There must be a way how to do that in touch (I touch a tile - it is selected now). Do you have any ideas?
Thanks
image of my Gameboard can be found here - http://img171.imageshack.us/img171/7814/checkers.gif
Another (easier?) alternative is to use Android's standard Button/ImageButton. You can customize its border and content, if you don't want the default border to show up.
The standard Buttons works with both touch and D-pad; so you can cut the amount of coding you need to make tiles that behave properly under both situations.
Store tile locations in a 2d Array. On the finger down event, check the event location against each tile. When you find the tile that was poked, select it.

Categories

Resources