Android:如何为android活动制作翻转动画,就像iphone从左到右水平翻转一样?
在我的应用程序中,我想翻转视图.. 我在iPhone上看过这样的动画。我想在我的 Android 应用程序中实现同样的功能。
我想翻转整个活动视图。是否可以 ? 我见过一些 android 中翻转的例子。但在所有示例中,视图都位于同一个活动中。是否可以为不同的活动设置这样的视图。或者从一项活动转到另一项活动时达到这样的效果?
请参阅 iPhone 中翻转效果的快照:
如果是,请参考任何演示示例或代码。 谢谢。
In My application i want to flip the view..
I have seen such animation in iPhone. And Same thing i want in to my android application.
I want to flip the whole activity view. is it possible ?
I have seen some example for the flip in android. But in that all example the view is in the same activity. Is it possible to set such view for the different activity. or to do such effect while going from one activity to another ?
Please see the snap for the Flip effect in iPhone:
If Yes then please give reference to any demo example or code.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首先定义您自己的动画并将其存储在 res->anim 或 java 类下的 XML 中。除了 Eclipse 中的 SDK 下载附带的 API 演示之外,我没有任何工作示例,如果您正在寻找翻转动画,请尝试查看 3D Transition 类。
之后让您的活动加载该动画,最好在 onCreate 中加载它。请参阅此问题
Firstly define your own animation and either store it in XML under res->anim or java class. I don't have any working example other than API Demos that comes with the SDK download in Eclipse, if you're looking for a flipping animation try to look at 3D Transition class.
After that have your activity to load that animation, preferably load it in onCreate. Please refer to this question
我见过的最令人信服的 Android 3D 翻转动画之一是在这里完成的 https://code.google.com/p/android-3d-flip-view-transition。
许多其他教程和示例代码不会产生可信的 3D 翻转。在 y 轴上进行简单的旋转并不是 iOS 中所做的事情。
这里还有一个视频:http://youtu.be/52mXHqX9f3Y
One of the most convincing 3D flip animations for Android I've seen is done here https://code.google.com/p/android-3d-flip-view-transition.
A lot of the other tutorials and sample codes don't produce believable 3D flips. A simple rotation on the y-axis isn't what's done in iOS.
There is also a video here: http://youtu.be/52mXHqX9f3Y
您可以使用这些 xml 文件制作一个非常相似的文件。
rotate_out.xml
rotate_in.xml
然后在 startActivity() 或 finish() 之后的代码中覆盖转换:
You can make a very similar with these xml files.
rotate_out.xml
rotate_in.xml
Then in your code override transition after startActivity() or finish():
iOS 肖像:
“许多其他教程和示例代码都不会产生可信的 3D 翻转。y 轴上的简单旋转并不是在 y 轴上完成的。 iOS。”
经过近 30 个小时的样品搜索后,我不得不同意。
我有一部电影,我可以在中间截图。
视图的右侧有:
- 向左移动并缩小至 95%。
视图的左侧有:
- 向右移动并缩小至 80%。
在 Android Full 下(初始状态):
Android 中:
Android 代码:
大多数示例中都可以找到该代码的改进版本:
<图像src="https://i.sstatic.net/UJ2eY.png" alt="improved android">
一些区别是:
- 视图的右侧不会像 iOS 那样移动。
这是 Android 相机轴:
我确实相信 Z 轴上的平移不能解决这个问题。也许不知何故也需要心理医生。
还是不够。太多的是左侧的收缩。
At iOS portrait:
"A lot of the other tutorials and sample codes don't produce believable 3D flips. A simple rotation on the y-axis isn't what's done in iOS."
After almost 30h searching for samples I have to agree.
I have a movie, where I could take a screenshot at the middle.
The right side of the view has:
- a movement to left AND a shrink to 95%.
The left side of the view has:
- a movement to right side AND a shrink to 80%.
At Android Full ( initial state):
Android middle:
Android code:
An improved version of the code can be found in the most examples:
Some differences are:
- the right side of the view doesn't move as how the iOS.
Here is the Android Camera axes:
I do believe a traslation on Z axes doesn't fix it. Maybe needed a shrink too somehow.
Still not enough. To much is the shrink the left side.