I am implementing a simple paint application (Finger paint android). I would like to use two fingers for both scaling and zooming. Should I use different listeners and detectors for both. The problem is that when i try to scroll with two fingers zooming kicks in and the screen just jumps. Can you please point me to implementations.
Thanks
You can use ScaleGestureDetector to easily detect things like pinch-to-zoom. Go through this Android developers blog post for a detailed explanation.
Related
I am currently looking into the sample sceneform app and I notice that when I run it, I can translate the model when I drag it with one finger and rotate it with two fingers.
What I want to do is the translation to be done when two fingers are on screen and moving, and the rotation with only one finger moving left/right.
Since the documentation for ARCore is currently not finished it is hard to figure it out on my own with the decompiled ARCore code.
Thanks!
You would have to provide an own TransformationGestureDetector for the TransformationSystem of the ArFragment. But that does not seem to be easily possible at the moment. So you would have to skip the ArFragment and use ArSceneView directly. That one behaves like a default Android View so you can use an onTouchListener and use a GestureDetector to detect the gestures. But in this case you have to do rotation and translation of your objects on your own.
I am developing a RDP application using android 3.0. I am using surface view to display the images. Is there any way to implement pinch zoom functionality for surface view(I am trying to zoom the image).
Subclass surfaceview and implements onTouchEvent(). Use a GestureDetector and GestureListener to modify a matrix representing the current state of manipulation and draw your canvas modified by this matrix.
It works, but is a piece of software to figure out. Took me around 6 weeks to have everything set up correctly, especially if you want some overlay items which also listen to touch events. I'd think about publishing that code, but it's company code...
I have a following problem -
I am developing an application and i decided for the GLSurfaceView because i needed openGl for a better and more natural page curl animation.
Having achieved that, now i find myself in a bit of a problem, since i cannot find a tutorial of any kind to implement pinch zoom on GLSurfaceView. I captured the event, the distances between fingers, scale, etc... But i do not know how to perform the actual transformation.
I found the one transforming ImageView via matrix, but alas...
Anyone done pinch zooming in openGl?
I don't think there is any need to post the code, but i will do it if it will nelp you in answering.
you can use the concept of scalegesturedetector to implement Pinch zoom , refer http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html
I implemented a custom android SurfaceView class which draw (onDraw method) something often bigger than the available device width and height. When the user toutch the screen and move it's finger I need to implement a kind of picture movement with a speed and direction matching the speed and direction given by the user. That part I'm able to do it within onTouchEvent method. But here is my question: now I also want the speed to decelerate progressivly. I think this probably have to be coded with DecelerateInterpolator... Is there some samples or demos somewhere involving a SurfaceView, onTouchEvent and DecelerateInterpolator... ?
I was thinking of a too complicated way to address the problem. Finally found a way to solve my problem here: Smooth scrolling in Android The OnGestureListener simplify all gestures management.
If a user does a "pinch zoom" on the map, my overlays don't properly size until the end. This has been noted in other posts, so i assume it is a known issue.
Problem is, my client finds it totally unacceptable, as I am tasked with making the android app look as good as the iphone version.
Is there any way to correct this, even if it is a horrible hack? For instance, can I subclass the mapview and handle drawing or override some other method?
The common solution is to not draw overlay during zoom animation.
UPDATED:
Sorry, I've confused zoom and move.
The problem with zoom is that you can't rely on zoom level. Instead you need to draw your overlay based on MapView.getProjection().