imageview touch event issue in android - android

I am implementing a drawing canvas and zoom for custom imageview in android. Both are implementing the touch event, if the user touches, I have to draw canvas and if the user flings with two finger I have to zoom imageview. Touch will fire for only one event canvas is working the zoom is not working. Can anybody tell me how to implement these two functionalities?
Thanks

Using a GestureListener you can do it, or you should read all the inputs and make the logic to know what the user is doing.

Related

How to send touch event equally to gesture Overlay view and Canvas

I do not know what is going on. I am hiding the gesture drawing , rather then this I am planning to show the the drawing drawn by the paint and canvas.I am using the drawing panel class which is working fine if used alone as shown in this question. It is drawing perfectly.
Now what I was thinking and tried is this , I have implemented the gesture overlay view alone and it was working and detecting gesture. But due to some reasons I am manipulating these two methods all together 1.Paint to draw on canvas 2 gesture to recognize user gesture while drawing on Canvas
Now what I am trying and expecting is , When user draw A on canvas the the canvas starting following the user finger and starts drawing but I think as when the gesture overlay starts detecting gesture, it looks like that the touch is passed to gesture overlay view where as the Paint and canvas stops further drawing.
What I want :
I want that the touch event should be received by the canvas and gesture overlay equally , so that they both work independently.
In simple Words , Do you have any idea how to send touch event to both of these equally ?
Ok there it is , I found the solution , if some one also trying to get it , I mean to use Gesture overlay view , while having other child. Just put the following line in the gesture overlay view xml
android:eventsInterceptionEnabled="false"
and it would start working .

detect if a touch event happens inside a shapeDrawable

I am drawing a number of ShapeDrawables through a canvas in a custom android view. I have an onTouchEvent method and it's working fine. Everything is working fine. Now I want to be able to detect if a touch event intersects (i.e. happens inside) a certain ShapeDrawable. Is there a way to do that?
I got the answer:
sd.getBounds().contains(x, y)

trouble creating a continuous zoom in (android)

i am trying to write an Application for android that zooms in AFTER the user FINISHED dragging or touching the screen (this means at motionEvent.ACTION_UP).
i want it to be continuous just like in a pinch zoom, but the problem is that pinch zooming is a continuous action and therefore create many events , what i am looking for is a SINGLE event (motionEvent.Action_up) that will cause continuous zooming.
Thanks in advance.
After MotionEvent.ACTION_UP you should set a timer which will repeatedly, and slowly, zoom over the designated area you decide (Instead of zooming according to future motion events, like in pinch zooming).

PinchZoom and paning using surfaceView

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...

how to use html5 canvas drag on android?

I want to use a WebView with a canvas, and to be able to use touch to drag items in the canvas. The canvas is displayed just fine, and clicking works, but moving only scrolls. I've disabled scrolling, but it still doesn't work. Any ideas?
I found working html here
http://developer.appcelerator.com/question/55121/html5-canvas-drawing-in-webview
It appears that I need to learn more about the difference between touch events and mouse events.

Categories

Resources