ListView GridView shielding and nesting method LPF

2023-01-23   ES  

First introduce the better information found online:

http://wayfarer.javaeye.com/blog/460284

http://goro.javaeye.com/blog/402163

http://www.williamhua.com/2009/04/23/android-touchscreen-gesture-recogniton/

Summary:

1.ONGESTURELISTENER has to be used with OntouchListener, because only onTouchListener is the actual monitoring of the user’s touch. It touches the “gesture recognition category” of all the monitoring users. Functions, such as onFling, Onlinepress, and so on.

2. If the incident will not continue to be passed on and return to TRUE, such as onFling, ONSCROLL, ONSINGLETAPUP

      3.MotionEvent Getx is an X -axis coordinate value calculated based on the upper left corner of the widget. The X -axis coordinate value calculated based on the upper left corner of the screen as the original point calculated by the upper left corner of the screen.

  4.long press and slide invalid,GESTUREDETECTOR defaults to open the LongPress notification, but there is a problem. After long pressing, the hand does not leave the screen and slide. At this time, it is found that there is no sliding event.In the HomeScreen of Monolith, what needs to be slid after long pressing, long pressing does not need.

This problem is to set up gesture recognition objects, and prohibit growth and pressing incident

mGestureDetector.setIsLongpressEnabled(false);

Of course, there is no disable long -press incident, and the sliding incident is still effective. It is only necessary to ensure that you slide immediately after the touch screen. Do not wait for the system to generate long press.

5.Newly create a class inherited SimpleongEntureListenercan achieve the following Event events.
      boolean  onDoubleTap(MotionEvent e)
Explanation: Double -click the second Touch Down trigger
     boolean  onDoubleTapEvent(MotionEvent e)
Explanation: Both the second Touch down and UP of the double -click will be triggered, and it can be distinguished by e.getAction ().
     boolean  onDown(MotionEvent e)
Explanation: triggers when Touch Down
     boolean  onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
Explanation: After sliding a little distance, it is triggered when UP.
     void  onLongPress(MotionEvent e)
Explanation: Touch is triggered when not moving.
    boolean  onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
Explanation: Touch triggers when sliding.
    void  onShowPress(MotionEvent e)
Explanation: Touch is triggered when sliding(andonShowPress, onlongpress comparisonONDOWN as long as Touch Down must be triggered immediately.and Touchdown after a while without sliding, first trigger onshowpress and then the onlinePress.So Touchdown has not slid after, and onDown-> ONSHOWPRESS-> ONLONGPRESS.
    boolean  onSingleTapConfirmed(MotionEvent e)
    boolean  onSingleTapUp(MotionEvent e)
Explanation: The two functions above are not sliding after Touch down, and no longer holding (onlinepress), and then triggered when Touchup.
Click very fast (not sliding) Touchup:
   onDown->onSingleTapUp->onSingleTapConfirmed
Click to be slightly slower (not sliding) touchup:
   onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed
2) Create a new GESTUREDETECTOR object in View.
Construction function
    gestureDetector = new GestureDetector(new HahaGestureDetectorListener());
and then use this in View’s onTouchevent as follows

@Override
public boolean onTouchEvent(MotionEvent event) {
    gestureDetector.onTouchEvent(event);
}

and then you can be in

Write your own code in theHahaGestureDetectorListenerevent.

Note: SimpleongEongEstureListener does not provide onup (), and you have to write the corresponding code in the cases of viewing motionEvent.action_up: in the view of view.

source

Related Posts

Deep Learning Papers (10) — Multiple-Human PARSING in the Wild

suffix expression

HDU — 1114 Question Piggy-BANK

response.getWriter (). The difference between write () and out.print ()

ListView GridView shielding and nesting method LPF

Random Posts

Unity Draw Meshbig

Android Studio Common plug -in and dependent ABNER

Introduction to use Visual Studio 2010 expansion kit: NUGET kit administrator

c ++ sort () underlying logic

wp listbox traversing datatemplate (get all controls)