【问题标题】:android swipe gesture functions安卓滑动手势功能
【发布时间】:2015-06-23 13:09:14
【问题描述】:

谁能告诉我如何在滑动手势中添加功能?例如 onSwipeRight(),我不想烤面包,而是从一到十计算屏幕被刷了多少,然后将该数据存储在某个变量中?就像三星 Galaxy s5 图像编辑器在改变图像亮度时所做的那样

imageView.setOnTouchListener(new OnSwipeTouchListener() {

    public void onSwipeRight() {
        Toast.makeText(MyActivity.this, "right", Toast.LENGTH_SHORT).show();
    }

    public void onSwipeLeft() {
        Toast.makeText(MyActivity.this, "left", Toast.LENGTH_SHORT).show();
    }


    public boolean onTouch(View v, MotionEvent event) {
        return gestureDetector.onTouchEvent(event);
    }
});

【问题讨论】:

    标签: android swipe gesture


    【解决方案1】:

    使用GestureDetector 检测onFling 或仅使用https://stackoverflow.com/a/19506010/4651112 中的OnSwipeTouchListener

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多