touch-event

Android: ItemizedOverlay onTouchEvent and onTap overlapping

情到浓时终转凉″ 提交于 2019-11-27 15:24:14
问题 I am trying to place a marker on a map overlay and then present a dialog when the user selects the drawable. The problem is the events seem to overlap. After I click the map and the marker is drawn, the onTap fires immediately afterwards, and because I have just drawn the marker, it is directly under the onTap event, so my dialog always fires. Does anyone have any suggestions on how to make these events mutually exclusive? Here is the code for the map activity: public class SelectGameLocation

Android - Detect End of Long Press

别说谁变了你拦得住时间么 提交于 2019-11-27 14:23:09
I am working on application in which a user needs to press and hold a button for a long time. How can I detect the moment that the user: finishes the press or moves their touch position? Thanks I think your best bet is to use a combination of the onLongClickListener() and onTouchListener() for that button. You'll need to catch certain events on the touch listener since it will trigger for every touch event. Try something like the following: class Blah extends Activity { private Button mSpeak; private boolean isSpeakButtonLongPressed = false; @Override public void onCreate(Bundle icicle) {

Get Canvas coordinates after scaling up/down or dragging in android

[亡魂溺海] 提交于 2019-11-27 11:36:20
I'm developing an application in which I'm pasting images, doing drawing and painting on canvas. This app can also Scale up/down the canvas or drag it to different location. My problem is: I can't get the correct canvas coordinates after scaling or dragging the canvas. I want to draw finger paint after the canvas is scaled or dragged but unable to retrieve the right place where i've touched..:( Also I'm new bee. Here is the code. @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.save(); //canvas.translate(mPosX, mPosY); canvas.scale(mScaleFactor, mScaleFactor, super

Android - How to circular zoom/magnify part of image?

半世苍凉 提交于 2019-11-27 10:34:32
问题 I am trying to allow the user to touch the image and then basically a cirular magnifier will show that will allow the user to better select a certain area on the image. When the user releases the touch the magnified portion will dissapear. This is used on several photo editing apps and I am trying to implement my own version of it. The code I have below does magnify a circular portion of the imageview but does not delete or clear the zoom once I release my finger. I currently set a bitmap to

Android drawing a line to follow your finger

孤街浪徒 提交于 2019-11-27 10:02:06
问题 What I want to do is to draw a line that will follow my finger. I've created a custom view, and I have an onTouchEvent() that works. I can draw a static line in the onDraw() method without much trouble. I'm not really sure how to get the line to draw as my finger moves though. public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { Log.e(TAG, " - DOWN -"); Log.e(TAG, " getX: " + event.getX()); break; } case

Dynamically generated line with glow effective

柔情痞子 提交于 2019-11-27 09:29:44
问题 I want to draw line with glow effect like this The problem - i must generate this line in program in dependence on user's interaction ( the form of line will be generated in onTouchEvent - ACTION_MOVE ). Can i generate this effect without xml files or drawing premaid bitmap ? 回答1: I imitate this effect in this way : Draw line with BlurMaskFilter; Draw over it normal line. I use Path class to generate line and save coordinates of MOVE_ACTION event to generate only part of path what i need.

How to add sound while UIScrollview is scrolling in iphone sdk?

断了今生、忘了曾经 提交于 2019-11-27 09:05:38
问题 This is my code for adding sound while UIScrollview is scrolling in iPhone SDK. In this code, how to add the sound while using touch-events in scrolling? Please give me your idea and suggestion or sample. const CGFloat kScrollObjHeight = 151.0; const CGFloat kScrollObjWidth =320.0; const NSUInteger kNumImages = 5; - (void)layoutScrollImages { UIImageView *view = nil; NSArray *subviews = [scrollView1 subviews]; CGFloat curXLoc = 0; for (view in subviews) { if ([view isKindOfClass:[UIImageView

Android MediaController intercepts all other touch events

佐手、 提交于 2019-11-27 07:41:51
问题 The top half of my app has a VideoView with a MediaController under it. The bottom half is an image with some buttons. While the MediaController is visible, the buttons below are not clickable. It's like while the MediaController is visible, it intercepts all other touch events, even if they are not within the bounds of the MediaController . Any idea around that? 回答1: You can check out my answer on overriding dispatchTouchEvent() to pass clicks through MediaController to an underlying Button

how can i bind touch events for a marker in google maps?

核能气质少年 提交于 2019-11-27 07:04:16
问题 google maps api does not support touch events but now i need to do some thing on the map and marker, such as long tap the map, tap the marker,drag the marker. what i wanna do is the same as the google maps client for iOS 回答1: I implemented touch events the same way as shreedhar, but using the "mousedown" event. I've found that "click" isn't triggered on mobile devices when using the Google Maps API in a webview (i.e. PhoneGap), but the "mousedown" event is triggered by a tap on mobile or a

onTouchEvent onClick onLongClick calls

倖福魔咒の 提交于 2019-11-27 06:43:21
问题 In our application we handle the events in button to record data. So initially when i use setOnLongClickListener() and setOnClickListener() together with the same button, it work fine for us. That means it will call both this listener base on the click and LongClick of the button. Now when i tried to use setOnTouchListener() with the same button together with setOnLongClickListener() and setOnClickListener() then only OnTouch event is working, rest onclick and onLongclick event doesnt work.