我有一个纸牌游戏,我希望单击以在卡片上执行操作,而卡片上的长按则显示卡片的更大图像。我知道有GestureListener,但我该如何使用它?这是我的代码:
gd = new GestureDetector(this, this);
gd.setOnDoubleTapListener(new OnDoubleTapListener()
{
@Override
public boolean onDoubleTap(MotionEvent e)
{
Log.d("OnDoubleTapListener", "onDoubleTap");
return false;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e)
{
Log.d("OnDoubleTapListener", "onDoubleTapEvent");
//if the second tap hadn't been released and it's being moved
if(e.getAction() == MotionEvent.ACTION_MOVE)
{
}
else if(e.getAction() == MotionEvent.ACTION_UP)//user released the screen
{
}
return false;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e)
{
Log.d("OnDoubleTapListener", "onSingleTapConfirmed");
return false;
}
});
答案 0 :(得分:2)
错误... yourCard.setOnLongClickListener()?