本文介绍了简单的滑动手势活动教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在扫描gesutes寻找一个含有源代码的turoial,我不想要一个视图寻呼机,我想要一个滑动手势教程。
这里是一个我发现但不适合我的例子
im looking for a turoial with source code on swipe gesutes, I dont want a view pager, I want a swipe gesture tutorial.here is one example I found but doesnt work for me
我想要这样的东西,谢谢
请不要查看寻呼机
I would like something like this, thanksPlease no view pagers
推荐答案
SimpleOnGestureListener mySimpleGestureListener = new SimpleOnGestureListener()
{
@Override
public boolean onDoubleTap(MotionEvent e) {
Logout.debug("onDoubleTap");
return super.onDoubleTap(e);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY)
{
String velocity="onFling: \n" + e1.toString() + "\n" + e2.toString() +"\n"
+ "velocityX= " + String.valueOf(velocityX) + "\n"
+ "velocityY= " + String.valueOf(velocityY) + "\n";
Logout.debug("onFling velocity="+velocity);
return super.onFling(e1, e2, velocityX, velocityY);
}
@Override
public void onLongPress(MotionEvent e) {
Logout.debug("onLongPress: \n" + e.toString());
super.onLongPress(e);
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
Logout.debug("onSingleTapConfirmed: \n" + e.toString());
return super.onSingleTapConfirmed(e);
}
private boolean permissibleYVelocity(float velocityY)
{
if ((velocityY < -200) || (velocityY > 200))
{
return false;
}
else
{
return true;
}
}
};
GestureDetector myGestureDetector = new GestureDetector(mSimpleOnGestureListener);
View.OnTouchListener mOnListTouchListener = new OnTouchListener()
{
@Override
public boolean onTouch(View view, MotionEvent event)
{
Logout.debug("list onTouch()");
return myGestureDetector.onTouchEvent(event);
}
};
这篇关于简单的滑动手势活动教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!