如何控制从另一个页面viewPages页页面、viewPages

2023-09-09 21:11:27 作者:孤独的夜

我有一个 ViewPager 在每一页共3页与的ListView 。我想动画的ListView 的方式,当用户输入翻页水平挥笔的ListView 的项目应根据来宽度下一页的。

I have a ViewPager with 3 pages with listView in each page. I want to animate listView in a way that when user swipes horizontally for next page the items of listView should come according to the width of next page.

即第一项应在完全被推动时,第二应该是可见的一半,口渴应该是第二等的可见半

i.e The first item should be pushed in completely ,second should be visible half ,thirst should be visible half of the second and so on.

这类型的动画已经在MI3 xiamo联系人列表中。

This type of animation is already in mi3 xiamo for contacts list.

在我在正确的direction.Note刷卡最近的列表项的知名度上面图片。

In above image I am swiping in the right direction.Note the 'Recent' list items visibility.

这将是一个很大的帮助,如果有人可以帮助我做这个animation.Please分享到的ListView 动画一些链接或提示根据 ViewPager 。

It would be a great help if someone could help me doing this animation.Please share some links or hints on ListView animation according to page change in ViewPager.

推荐答案

你有没有研究过 OnPageChangeListener.onPageScrolled(INT位置,浮positionOffset)方法,它作为ViewPager的刷卡监听器?你可以做什么用的 positionOffset 的价值,它的一个百分比值,它从0到1或反转,告诉我们如何显示在未来页的多体,应对最近呼叫列表中的项目该值,设置其离开轴在getView()方法。

Have you ever studied the OnPageChangeListener.onPageScrolled(int position, float positionOffset) method which used as ViewPager's swipe listener? you can do something with positionOffset's value, its a percentage value that from 0 to 1 or reversal, informing us how much body of the coming page displayed, deal with the "Recent Call" List item by that value, set their left-axis in getView() method.

------------------在2014年10月3日更新1 ------------------

------------------ update 1 in 2014-10-03 ------------------

我已经尽力去完成这个效果,但我不能让在这个时候,动画作品。我已经作出这样的ListView告知刷卡偏移量(增量),并尽我所能为他们的项目,它看起来将关闭我们想要的效果。但非常复杂的部分是我们必须弄清楚如何兼容通过手指刷卡或一扔和方法直接切换。

I've been try to accomplish this effect, but I can't get that animation work in this time. I already make that ListView informed about the swiping offset(delta) and do whatever I can for their items, it looks going to close the effect we wanted. But the very complicate part is we must figure out how to compatible with swiping or fling by finger and directly switching by method.

我试着三天寻求ViewPager的规则,检查ViewPager和ListView的源下去,但不会从正收益。所以,我把我的项目以github上,我非常希望我能得到一些帮助从一些球员,任何提示将AP preciate,先谢谢了。

I'm try three days to seeking the rule of ViewPager's, checking ViewPager and ListView's source either, but doesn't return from positive. So I push my project to github, I hope very much I could get some help from some guys, any tips would be appreciate, thanks in advance.

------------------更新2在2014年10月4日------------------

------------------ update 2 in 2014-10-04 ------------------

以下GIF会解释不清楚的动画。

following GIF would explain the animation exactly.

------------------在2014年10月7日更新3 ------------------

------------------ update 3 in 2014-10-07 ------------------

好吧,看来我没能完全重现此动画。要成为一个有价值的结局,我做我的项目工作,至少也尽我所能,接近原来的效果。检查我的第一个更新的项目GitHub的取整的工作,希望我的帮助: - )

Alright, it appeared I'm failed to fully reproduce this animation. To be a valuable ending, I made my project work at least, also do my best to approaching the original effect. Check my first Update's github project to take the whole work, hope I do the help :-).