[英]android swipe gesture functions
誰能告訴我如何以滑動手勢添加功能? 例如onSwipeRight(),我不想烤面包,而是從一到十計算屏幕被刷了多少,然后將該數據存儲在某個變量中? 就像三星銀河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);
}
});
使用GestureDetector
檢測onFling
或僅使用https://stackoverflow.com/a/19506010/4651112的 OnSwipeTouchListener
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.