Android gesture events quickly move long press the touchscreen, press the touch screen, and drag

Source: Internet
Author: User

/* The user presses the touchscreen, quickly moves after releasing the public boolean onfling (Motionevent E1, motionevent E2, float Velocityx, float velocityy) {//Parameter explanation://E1:1th Action_down motionevent//E2: Movement speed on the last action_move motionevent//velocityx:x axis, pixels per second//movement speed on velocityy:y axis, pixels per second//Trigger condition: The coordinate displacement of the x-axis is greater than fling_min_distance and moves faster than fling_min_velocity pixels per second if (E1.getx ()-E2.getx () > fling_min_distance& & Math.Abs (Velocityx) > Fling_min_velocity) {//FLING Lefttoast.maketext (this, "FLING left", Toast.length_short) . Show (); ElseIf (E2.getx ()-E1.getx () > fling_min_distance&& math.abs (Velocityx) > Fling_min_velocity) {//FLING RI Ghttoast.maketext (This, "Fling right", Toast.length_short). Show (); return false;} User long press touch screen, triggered by multiple motionevent action_down @overridepublic void onlongpress (Motionevent e) {//TODO auto-generated method stub}//user presses the touchscreen, and drags, by 1 motionevent action_down, multiple Action_move triggering @overridepublic boolean onscroll (Motionevent E1, Motionevent E2, float Distancex, float distancey) {//TODO auto-generated method stubreturn false;} User long press touch screen, triggered by multiple motionevent action_down @overridepublic void onlongpress (Motionevent e) {//TODO auto-generated method stub}//user presses the touchscreen, and drags, by 1 motionevent action_down, multiple Action_move triggering @overridepublic boolean onscroll (Motionevent E1, Motionevent E2, float Distancex, float distancey) {//TODO auto-generated method Stubreturn false;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.