Parallax Effect in Android#39;s ViewPager(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 中的视差效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android 的 ViewPager 中的视差效果
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
