I have a plaine object which have an image. I want to implementing Zoom in\out this object.
I try use
Matrix.setScaleM(...)
and it works, but it just increases the image in the middle instead of gradually come to the place that I need. At this point I want to make something like a gallery, on each phone it is - open Gallery on your phone and see - when you try to zoom in image - viewport gradually moved to zoomed viewport. So how can i do that?
Related
I have a custom photo gallary app which shows images from a specific folder.
what is not clear to me is how to navigate between images smoothly following the finger movement, like this:
As seen by touching the display and moving to left, current image moves also corresponds to the finger movement and depending on where finger is up, current photo is stayed or replaced by the next photo (I hope image is clear enough!).
Could anybody please explain me how to make this effect?
I have tested ImageSwitcher but it is not how I want: in onTouch() method, I can detect the gesture (moving to left or right) and using a proper animation change images, but it is not possible to smoothly follow the finger movement.
Well, you might not want to try it because you have already done some work on your implementation, but :
The easiest way is to use a ViewPager that handles the scroll (and creates/deletes views when needed) and just override the default transformation with a PageTransformer.
I made an Image Viewer with TouchImageView that I forked to my needs. In particular, you can fit the image vertically in the screen, and then drag the image from left to right. This is nice for a panorama, for example, that you can drag and see it all.
Now I want to do exactly this with panoramas without touching the screen, that is, an automatic constant drag.
I tried to implement this through a TranslateAnimation, but failed miserably: TranslateAnimation "moves the view", and the image is slowly being replaced with a growing black strip instead of more image.
Of course I can move the image 1 pixel, wait 1/100s, move again and so on, but there should be an easier way (and consuming less resources).
Is there some option in TranslateAnimation that allows to do this? How would you do it?
Thanks!!
End Goal: Getting a speedometer style needle to move around a dial according to test results.
Current Issue: At the moment I have placed the needle on top of the speed dial as a sperate image using FrameLayout. I have been scouring the web for a way to position the needle with coordinates so I can have it exactly where I want it on the dial. I would post an image but I'm new to the forum and I'm not allowed!
So in short can I position an image over another image with exact coordinates (allowing for rotation etc)? Am I going the right way about solving my problem?
There is the AbsoluteLayout, which lets you use absolute positions, but it is not recommended that you use it.
Instead, you should create your own extension of a View, that draws your dial and needle. For more info on this, look at Maurycy's comment, which recommends this part of the manual.
Calculate measurements and rotate image of indicator accordingly.
I would like to be able to view a rather large image (floor plan) that can be fully viewed by moving around the picture. When I click on the image, I would also like to get the coordinates on that image.
I've followed this tutorial 1 which works correctly and so allows me to move around the image. After that I also added some functionality to get the position of where I touch the screen. However, when moving around the image, black borders surround it (see picture below), which causes me to get incorrect coordinates.
So would somebody know how I could a) fix/remove the black borders when moving the image or b) correct the coordinates I receive by e.g. removing the border offset?
1 http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-2-building-the-touch-example/1763
When you move around the image, set the scroll to stop before it reaches the edges of the image. Use this link for further details.
As for your coordinates, check these other 2 links: link1, link2.
Hope these would help you.
I've got a Gallery class showing a bunch of images in an Android app, but since only one image is ever displayed at a time, it is difficult for the user to see when they have reached the first or last image in the gallery. Is there a way to mimic iOS' "rubber band" effect, so that the user sees a bit of empty space when dragging the last image, and they release it, the image snaps back to the center of the view. Is this possible to do?
Look into easing equations
http://www.gizma.com/easing/
when releasing the screen while been dragging the last image, you can use them to smoothly animate the image back to the center of the screen.
As for the effect while dragging the last image, use a multiplication factor on the position of the image so the more your finger reaches the side of the screen, the less the image will follow its movement.