Android View / ViewGroup 上的 3D 转换
我正在尝试制作一个 3D 外观的可滚动列表,其中元素堆叠成一行,向前和向后移动,并且所有这些都需要具有 3D 外观(后面的元素淡出并缩小等)。问题是,前部元素在移出视图(即更靠前)时需要在 X 轴上旋转并有点“下落”,就好像它从传送带的一端落下一样。
我广泛搜索了一个优雅的解决方案,该解决方案不涉及开发真正的 3D 环境或应用整个代码库,但找不到任何此类内容。我真的是一个 Android 开发新手,所以我想我可能忽略了一些东西。
唯一接近它的解决方案是使用 0 持续时间动画,通过 Camera 类将旋转变换应用到 View 的画布上,但这还不够好,因为 View 的边界正在裁剪旋转的内容,让我们面对现实 -这是应用像旋转这样微不足道的东西的一种歪曲的方式。
难道真的没有简单的方法来旋转视图吗?我的意思是,iOS 有,Flash 有,甚至 CSS3 也提供了一种不费吹灰之力就能做到的方法。
我的目标是 API 10 (2.3.3) 及更高版本。
I am trying to make a 3D-looking scrollable list, with elements stacking in a row moving forward and backwards, and all that needs to be 3D-looking (back elements faded out and scaled down, etc). Problem is that the front element, when moving out of the view (more to the front, that is) needs to rotate on X-axis and sort of "fall down", as if it was falling from an end of a conveyor belt.
I have searched far and wide for an elegant solution that does not involve developing a real 3D environment or applying whole code libraries, but could not find anything of the sort. I am really a noob at developing for Android, so I guess I might have overlooked something.
The only solution that came close to it was using a 0-duration animation that applied rotation transformation via Camera class onto View's canvas, but that wasn't a good enough 'cause the View's boundaries were clipping the rotated content, and let's face it - that's a crooked way to apply something as trivial as rotation.
Is there really no simple way to rotate Views? I mean, iOS has it, Flash has it - even CSS3 gives a way to do it without breaking a sweat.
My target is API 10 (2.3.3) and up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论