基于Android游戏开发20回合.docVIP

  • 5
  • 0
  • 约9.04万字
  • 约 64页
  • 2017-09-11 发布于浙江
  • 举报
Android游戏开发20回合 试 阅: ……下面我们就以实现手势识别的onFling动作,在CwjView中我们从View类继承,当然大家可以从TextView等更高层的界面中实现触控。 class CwjView extends View { ??? private GestureDetector mGD; ??? public CwjView(Context context, AttributeSet attrs) { ??????? super(context, attrs); ????? ??????? mGD = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { ??????????????? public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { ??????????????????? int dx = (int) (e2.getX() - e1.getX()); //计算滑动的距离 ??????????????????? if (Math.abs(dx) MAJOR_MOVE Math.abs(velocityX) Math.abs

文档评论(0)

1亿VIP精品文档

相关文档