开发者

Forcing animation on ViewPager

开发者 https://www.devze.com 2023-03-29 23:35 出处:网络
I\'d like to force the animation triggered by the finger-swipe on a ViewPager - something like, when I press a button ou开发者_运维问答tside the ViewPager, it does the fancy animation.

I'd like to force the animation triggered by the finger-swipe on a ViewPager - something like, when I press a button ou开发者_运维问答tside the ViewPager, it does the fancy animation. I've tried something like:

myPagerAdapter.instantiateItem(myPager, requested_view_id)

myPager.computeScroll()

myPager.invalidate()

But it didn't work.

Any ideas?

Thanks!


If you just want to have a button or another event move to the "next page" or "previous page" in the ViewPager use ViewPager.setCurrentItem(int item). This will also show the animation. You will just need to keep track of the current item yourself and then setCurrentItem(numCurrentItem + 1).

0

精彩评论

暂无评论...
验证码 换一张
取 消