2

There are a handful of questions out there, but none really provided a clear solution to this problem. Android does not have anything built in to do so, so Mike Ortiz implemented TouchImageView which is awesome. It works perfectly for what it is supposed to do. But now I want to turn this into a Gallery that uses the onFling gesture to scroll in another TouchImageView. What is the best way to do so?

Nick
  • 925
  • 1
  • 8
  • 13

2 Answers2

1

I forked MikeOrtiz's TouchImageView to add ViewPager compatible capability. Check it out here: Forked TouchImageView

Hank
  • 1,318
  • 10
  • 29
  • @Hank: I use TouchImageView too (highy recommended!!), that I also tweaked to avoid longclicks. I took a look at your code, and failed to find a fling gesture. I know that you can scroll when the image is zoomed. But is there a way to use fling, say, to go to the next image (when image is not zoomed) with your code? Thanks!! – Luis A. Florit Nov 07 '12 at 01:24
  • @LuisA.Florit, did you checkout README.md? It contains an example that works with ViewPager. ViewPager will do the fling things for you. – Hank Nov 07 '12 at 01:42
  • @Hank: oh, I see. So it is not TouchImageView that implements fling, as I understood. Got it now. Thanks!! – Luis A. Florit Nov 07 '12 at 11:03
0

I wanted the same functionality and I found out ViewPager is the best solution of all. http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html

Here is the sample code which may work for you,

Set default page for ViewPager in Android

Community
  • 1
  • 1
dcanh121
  • 4,665
  • 11
  • 37
  • 84
  • I haven't tried this yet, but I think I'll run into the same issue as I did with putting ImageTouchView in a gallery, the gallery overrides the touch events causing you not to be able to zoom in and out. – Nick Oct 13 '11 at 18:28