Android 的 ViewPager 中的视差效果 [英] Parallax Effect in Android's ViewPager

查看:17
本文介绍了Android 的 ViewPager 中的视差效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的片段中滑动时模拟视差效果,我已经阅读过 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 中的视差效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆