Android left to right swipe

I am new to Android. I need to scroll only from left to right and not scroll from right to left . What do I want to do? Are all examples shown from left to right, and from right to left?

+4
source share
2 answers

Take a look at the decision made here - Fling gesture detection on grid layout

This solution explains how to implement a simple gesture listener, and write left and right and right to left spaces. The corresponding code from the example is given in the GestureDetector onFling override method. In principle, if point 1 (e1) minus point 2 (e2) is greater than the specified minimum distance, then you know this from right to left. If point 2 (e2) minus point 1 (e1) was greater than the minimum travel distance, then it is left to the right.

 // right to left swipe if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { Toast.makeText(SelectFilterActivity.this, "Left Swipe", Toast.LENGTH_SHORT).show(); } // left to right swipe else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { Toast.makeText(SelectFilterActivity.this, "Right Swipe", Toast.LENGTH_SHORT).show(); } 
+1
source

You can use Drag and Drop You can study this tutorial. This is a very good tutorial.

http://www.vogella.com/articles/AndroidDragAndDrop/article.html

aur you can have alook for

http://developer.android.com/guide/topics/ui/drag-drop.html

+1
source

Source: https://habr.com/ru/post/1435840/


All Articles