问题描述
我试图在我的片段中滑动时模拟视差效果,我已经阅读过 beginFakeDrag 和 fakeDragBy 但老实说,我不知道它是否是解决我的问题的最佳方法.
I'm trying to emulate a parallax effect when sliding through my fragments, I've read about beginFakeDrag and fakeDragBy but to be honest, I don't know even if it's the best approach to my problem.
有人用 ViewPager 做过类似的事情,或者有关于我应该如何处理这个问题的提示吗?
Anyone has done something similar with the ViewPager or have a hint about how should I approach this?
谢谢
推荐答案
这个问题有点老了,但是当我试图这样做时,我发现了它......
This question is a bit old, but I found it when I was trying to do exactly that...
我实现了自己的解决方案,基本上扩展了 ViewPager
并覆盖了 onDraw
.
I implemented my own solution, basically extending ViewPager
and overriding onDraw
.
您可以通过一个简单的示例找到所有代码这里
You can find all the code with a simple example here
这篇关于Android 的 ViewPager 中的视差效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!