package com.cnmobile.beibei.utils;
import android.content.context;
import android.view.gesturedetector.******ongesturelistener;
import android.view.gesturedetector;
import android.view.view;
import android.view.view.ontouchlistener;
import android.view.motionevent;
/**
* 實現監聽左右滑動的事件,哪個view需要的時候直接setontouchlistener就可以用了
* @author linzhiquan
* */
public class gesturelistener extends ******ongesturelistener implements ontouchlistener
/**
* 向左滑的時候呼叫的方法,子類應該重寫
* @return
*/
public boolean left()
/**
* 向右滑的時候呼叫的方法,子類應該重寫
* @return
*/
public boolean right()
@override
public boolean onfling(motionevent e1, motionevent e2, float velocityx,
float velocityy)
// 向右滑
if (e2.getx() - e1.getx() > distance
&& math.abs(velocityx) > velocity)
return false;
} @override
public boolean ontouch(view v, motionevent event)
public int getdistance()
public void setdistance(int distance)
public int getvelocity()
public void setvelocity(int velocity)
public gesturedetector getgesturedetector()
public void setgesturedetector(gesturedetector gesturedetector)
}
jQuery手機實現左右滑動事件
隨著手機的不斷發展,移動端頁面已經逐漸成長起來,但對於移動端的手勢事件並不是十分完善,並沒有左右滑動事件。不過可以通過已存在的事件實現移動端頁面的左右滑動事件。移動端相關的事件 touchstart 手勢觸碰螢幕是觸發該事件 touchmove 手指在螢幕中移動時觸發該事件 touchend 手指離...
js的左右滑動觸屏事件
js的左右滑動觸屏事件,主要有三個事件 touchstart,touchmove,touchend。這三個事件最重要的屬性是 pagex和 pagey,表示x,y座標。touchstart在觸控開始時觸發事件 touchend在觸控結束時觸發事件 touchmove這個事件比較奇怪,按道理在觸控到過...
移動端的手勢事件 左右滑動
會聽過什麼左滑喜歡,右滑不喜歡,那麼這樣的滑動手勢如何實現,在此用touch事件來實現左右滑動的判斷 lang en charset utf 8 name viewport content width device width,user scalable no,initial scale 1.0,m...