A few months ago I complained that there is no standard widget for a swipe image viewer. I just asked about it on Twitter, and discovered that ViewPager
is what I wanted.
I updated my github project with a ViewPager
implementation, and it's so much simpler. On top of that, the images slide as your finger swipes across the screen, giving a much more satisfactory feedback.
Inline coding questions will not be answsered. Instead, ask on StackOverflow and put the link in the comment.
hello Chiu-Ki Chan.:)
ReplyDeleteyour article is very great, it's very useful for me. i am glad, i can find your blog.
but, there is something that i am still confused it when i see your project.
i want to make swipe button like your project.
so, how to make it? or i just change the imageview to image button?
my project is make navigation for blind people in campus, and then i want to make HCI (Human Computer Interaction) with UI like your project, i want to add TTS (Text To Speech)service in every action. for example is when the image/button is swiped, and when the image/button is pressed.
can you tell me how to add the TTS service?
i am very glad if you help me.
thank you Chiu-Ki Chan. :)
No, the ViewPaper isn't suitable if you just want to recognize the swipe gesture on the button. You should implement a SimpleOnGestureListener instead. See the old code in my github for an example: https://github.com/chiuki/android-swipe-image-viewer/tree/ImageSwitcher. In particular, you will be setting the touch listener on your button instead of mImageSwitcher.
Deletei am sorry Chiu-Ki Chan. i am too late to reply it again.
Deletei have solved my problem, and your article so help me to build my project.
thank you very much Chiu-Ki Chan. :)
you are so kind.
may you always successful. GBU.
Hello Chiu-Ki Chan,
ReplyDeleteI am new for Android development and find your blog by google. Your sample project is great but I have a question: Is it possible to expand it so that the user can zoom the image per 2 Fingers gesture like the modern gallery program in Android phone now?
my email address: katrina@me3.de
Thank you in advance!
With best regards,
Katrina
This comment has been removed by the author.
ReplyDeleteHiii...how r u...
ReplyDeleteThanks for u r post....My requirement is giving the animation to the gallary images.the images are swipe from corner. the next image come back from first image with shadow...
i hope u give reply
my email--bramhanandareddym@gmail.com
Hi Chiu-Ki Chan,
ReplyDeleteI am new in Android development, your sample is good, but i have a problem, I got many photo to view, when I start my activity, I want to go back to the last photo I had view, so, how can I save the current view position? and apply it like a bookmark. please advice. thanks.
wongkinkok72@gmail.com
You can set a OnPageChangeListener on the view pager and save the current page in onPageSelected(), then restore it with viewPager.setCurrentItem() later.
DeleteGreat Solution! You really saved my day :)
ReplyDeleteThank you.
Hi Chiu-Ki Chan,
ReplyDeleteGreat help and good piece of code ! Thanks !
hi, just stumble upon your blog and got exactly code that i wanted, thanks :D
ReplyDelete