Android将动画设置为singleTask [英] Android animate to singleTask

查看:365
本文介绍了Android将动画设置为singleTask的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个带有多个标签的应用程序(没有tabview)。加载需要很长时间,所以我只完成了一个任务。现在只需加载一次即可节省大量时间。



仅在onCreate中定义所需的转换:
OverridePendingTransition(R.anim.fade_in,R.anim.fade_out);



仅永不再次调用onCreate,我试图将其放置在onResume和onStart之上,但这也无济于事。



现在的问题是,该动画成为默认动画,在不同设备上差异很大。 / p>

有人知道更改此方法的方法吗?我尝试过在startActivity方法之后调用它,但也没有成功。



如果有人有解决方案来停止加载时间,那也不错。
加载时间用于在swipeview(jason fry)中创建多个listview。此列表视图每个包含大约90个图像视图,其中大多数是同一图像。



感谢您事先提出的​​任何想法,想法或解决方案。

解决方案

您应该覆盖活动的 finish()方法。
在覆盖的方法中,调用super.finish()后-用您喜欢的过渡调用 overridePendingTransition()(如果您不希望进行过渡,请定义一个不执行任何操作的过渡,持续时间为0)


I am making an app with multiple tabs (without the tabview). One takes a long time to load so I made a singletask of it. Now it only has to load once what saves a lot of time.

Only in the onCreate I define the transition I want: overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

Only the onCreate is never called again, i tried to put it on top of the onResume and onStart but that didn't helped either.

The problem now is that the animation becomes the default animation which differs a lot on different devices.

Does anyone know a way to change this? I tried calling it after the startActivity method with no succes either.

If anyone has a solution to stop the loadtime then it is also okey. The load time goes to making multiple listview in a swipeview (jason fry). This listview contains around 90 imageviews each, most of them are the same image.

Thanks for any thoughts, ideas or solutions in advance.

解决方案

You should override the finish() method of your activity. In the overridden method, after calling super.finish() - call overridePendingTransition() with your favorite transition (if you want no transition - define a transition that does nothing, with duration 0).

这篇关于Android将动画设置为singleTask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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