I am working with Android app to swipe an image from list view. But I don't know the answer. I got values in list view and where clicking an image with item click listener it shown in another intent, I want without going back, show image from top to bottom in list view using swipe method.
Asked
Active
Viewed 308 times
0
-
Have a look here, https://github.com/chiuki/android-swipe-image-viewer – K Neeraj Lal Jan 23 '17 at 07:12
-
Possible duplicate of [How to swipe images](http://stackoverflow.com/questions/5101629/how-to-swipe-images) – K Neeraj Lal Jan 23 '17 at 07:12
-
Here is full solution for such requirements: https://stackoverflow.com/a/44426980/6776960 – Hardik Maru Jun 08 '17 at 05:21
2 Answers
0
Use RecyclerView instead of listView because onTouchlistener will work more properly in recyclerview rather than listview.additionally listview have issue with adapting item position

Harmantj
- 182
- 2
- 11
-
Do you animate image from top to bottom??I am unable to understand this part of your question – Harmantj Jan 23 '17 at 06:58
-
no. I got images from my server in a recycler view and also i use on item click listener. it also working i need to see previous image or next image using swipe – Jincy Jan 23 '17 at 07:04
-
http://stackoverflow.com/questions/4139288/android-how-to-handle-right-to-left-swipe-gestures – Harmantj Jan 23 '17 at 07:20
0
add images in array.
int count=0;
int arr[count];
imageView.setOnTouchListener(new OnSwipeTouchListener(MyActivity.this) {
public void onSwipeRight() {
count++;
img.setResource(arr[count]);
if(count>arr.length-1)
{
count=0;
}
Toast.makeText(MyActivity.this, "right", Toast.LENGTH_SHORT).show();
}
public void onSwipeLeft() {
count--;
img.setResource(arr[count]);
if(count<0)
{
count=arr.length-1;
}
Toast.makeText(MyActivity.this, "left", Toast.LENGTH_SHORT).show();
}
}
});
hope you got the answer

Harmantj
- 182
- 2
- 11