touch-event

Identify triple tap on custom view

£可爱£侵袭症+ 提交于 2020-02-18 05:41:27
问题 I want to draw circle, whenever user taps on a custom view, and based on tap count circle color changes. Single Tap : YELLOW CIRCLE Double Tap : GREEN CIRCLE Triple Tap : RED COLOR Problem is that, i made one custom view that will count tap event based on time, but some time it miss the first tap. which cause the problem in view. Following code shows all my effort to make above custom view. TripleTapView package com.slk.car_rating_app; import java.util.ArrayList; import java.util.Date; import

Touch events on MKMapView's overlays

ε祈祈猫儿з 提交于 2020-01-29 03:56:44
问题 In the app I'm currently designing I have a MKMapView with overlays on it (customized MKPolylines btw) and I would like to be able to detect touch events on these overlays and assign a specific action to each overlay. Could any one help me on this one ? Thanks ! Benja 回答1: This can be solved combining How to intercept touches events on a MKMapView or UIWebView objects? and How to determine if an annotation is inside of MKPolygonView (iOS). Add this in viewWillAppear: WildcardGestureRecognizer

Can we implement Drag n Drop with touch events for mobile view?

不打扰是莪最后的温柔 提交于 2020-01-25 03:54:29
问题 I am using simple HTML-5, and using Drag n Drop feature in React JS, without any library. I have implemented on web, it's working good but when i come to mobile it doesn't work. There are touch events to handle touch things for mobile but i am not achieve any solution. Please recommend some thing which works well. 回答1: There are few shim libs that emulate HTML5 drag and drop on mobile devices. Example: DragDropTouch They usually clone element that you try to drag on touchstart , copy all

Method onTouchEvent not being called

前提是你 提交于 2020-01-20 16:52:26
问题 I'm having a problem that my method @Override public boolean onTouchEvent(MotionEvent event) { return gestureDetector.onTouchEvent(event); } is never called. Any ideas why is that so? I'm building a google's API 4.0.3 application, and I'm trying to enable swipes for my ViewFliper. However, it can't work because touch is never called. Code: public class MainActivity extends SherlockMapActivity implements ActionBar.TabListener { Thats the declaration of my activity. and to detect swipes i have

Implementing OnTouchListener on LinearLayout - Android Development

十年热恋 提交于 2020-01-13 15:00:15
问题 public class UnitConverterActivity extends Activity implements OnTouchListener { /** Called when the activity is first created. */ LinearLayout mLinearLayout; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLinearLayout = new LinearLayout(this); ImageView i = new ImageView(this); i.setImageResource(R.drawable.mainmenu); //i.setAdjustViewBounds(false); i.setScaleType(ScaleType.FIT_XY); i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP

Android : Get view only on which touch was released

别等时光非礼了梦想. 提交于 2020-01-10 04:26:04
问题 I am in a tricky situation, hope you can help me with it. I have few views (TextViews), horizontally placed one after another in a linear layout. When I press on textview1, drag my finger to any other textview and release touch, I want to be able to get the view(textview) on which the finger was lifted. I went over the TouchListener api, it says that every event starts with a ACTION_DOWN event action. Since other textviews won't fire that event, how can I get the reference to the textViews on

ScrollView within ViewFlipper does not work although using onTouchEvent

谁说胖子不能爱 提交于 2020-01-06 12:40:38
问题 In this post: Android: ScrollView in flipper It was suggested to set an onTouchnListener to the ScrollView which is part of a child of a ViewFlipper. I did that and also used the same logic: public class MainActivity extends Activity implements OnGestureListener { // ... @Override protected void onCreate(Bundle savedInstanceState) { // ... this.gestureDetector = new GestureDetector(this); // .. createViews(); } private void createViews() { LayoutInflater inflater = (LayoutInflater) context

Android AndEngine problem with touch events

Deadly 提交于 2020-01-06 10:54:45
问题 I'm learning andEngine and trying to make a simple game based on some examples. My problem is that the game stops in some random moments and I can only use back button ;/ I used logcat and found problem, here's log: /release-keys' I/DEBUG ( 2656): pid: 4918, tid: 4926 >>> com.homework.mygame <<< I/DEBUG ( 2656): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 3f8191d 4 I/DEBUG ( 2656): r0 00000000 r1 00000000 r2 3f800000 r3 000191d4 I/DEBUG ( 2656): r4 00140a30 r5 00149978 r6 449d9b18

Android onTouchListener stops receiving events when finger is moved up

随声附和 提交于 2020-01-06 08:48:34
问题 I have a custom view with the following OnTouchListener assigned to it in my activity: private OnTouchListener MyOnTouchListener = new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { System.out.println("onTouch called."); System.out.println("x" + event.getX() + ", y: " + event.getY()); return true; } }; This registers and displays events in the log as expected, until the user moves their finger up or down more than a few pixels. After this, no touch events are passed

Is “dragging with longclick” impossible on Android?

偶尔善良 提交于 2020-01-06 05:28:28
问题 I am working on charts. I can zoom in-out, dragging... Also I need longclick with dragging. if you need to explain, user can longClıck for see charts values, and user can dragging to left, right with longclick to see other values...Can Android sense it? I use achartengine library. I can handle it now:) but I have another problem about.. longPressDetector = new GestureDetector(getContext(), new SimpleOnGestureListener() { @Override public void onLongPress(final MotionEvent e) { int x = (int) e