How do you implement an onFling event in TouchImageView so it acts like the galleries you see in Facebook or Google+

1.2k Views Asked by At

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?

2

There are 2 best solutions below

1
dcanh121 On

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

3
Hank On

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