简体   繁体   English

如何在Android中为TabActivity更改设置动画?

[英]How to animate TabActivity change in Android?

Is it possible to animate the transition between an Activity in a tab to another one? 是否可以为选项卡中的Activity到另一个Activity之间的过渡设置动画? I mean, when the user clicks a tab in the TabWidget and the shown tab content changes to another Activity . 我的意思是,当用户单击TabWidget中的选项卡并且显示的选项卡内容更改为另一个Activity With the default configuration it just changes but I would like to have a smooth transition like a left-to-right slide or something similar. 在默认配置下,它只是发生了变化,但我希望能够平滑过渡,例如左右滑动或类似操作。

Thank you for your help. 谢谢您的帮助。

If you clone the TabActivity/Host/Widget implementation, it is easy to add animations to the tab switching. 如果克隆TabActivity / Host / Widget实现,则很容易将动画添加到选项卡切换中。 Here's a modified copy of a "tutorial" I did back when Donut was released. 这是我在发行Donut时所做的“教程”的修改后的副本。 It was a clone of the Donut core Tab implementation with some modifications to move/show/hide tab indicators, swap tab content, swipe between tabs. 它是Donut核心Tab实现的一个克隆,其中进行了一些修改,以移动/显示/隐藏选项卡指示器,交换选项卡内容,在选项卡之间滑动。

I just added animations to tab transitions. 我只是在选项卡过渡中添加了动画。

http://www.nexsoftware.net/android/tutorials/customtabswithanimation.zip http://www.nexsoftware.net/android/tutorials/customtabswithanimation.zip

It's probably not a "good" solution or the most efficient, but it works. 它可能不是一个“好的”解决方案,也不是最有效的解决方案,但它确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM