Move gallery view to next image with one click on Android?

I have four images in the gallery view. When we scroll left to right or right to left, viewing the gallery moves all the images, if I scroll left to right from the first image, and then move to all four images.

What I want is that when I sit down, he should only go to the next image. Can someone let me know how this is possible?

Hope to get an answer soon.

Sunil Relations

+3
source share
3 answers

, CustomGallery, Gallery. onFling Gallery. onFling false. , onFling.

+4

: ImageView Swipes GestureListener. ImageView. , .

+3

ViewFlipper fling...

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) 
{ 
    if (Math.abs(e1.getY() - e2.getY()) > 50) 
         return false; 

    if(e1.getX() - e2.getX() > 10 && Math.abs(velocityX) > 10) 
    { 
         vf.showNext();
    }  
    else if (e2.getX() - e1.getX() > 10 && Math.abs(velocityX) > 10) 
    { 
         vf.showPrevious();
    } 

    return false; 
}
0
source

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


All Articles