替代overridePendingTransition() - Android电子 [英] Alternative to overridePendingTransition() - Android

查看:150
本文介绍了替代overridePendingTransition() - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现了Android overrivePendingTransition()方法,它工作完全正常,exept一件事:
在设置/ Dispay菜单中,您可以选择显示无动画,一些动画或所有动画,而事实是,当它被设置为所有动画的方法仅适用。

I just discovered the android overrivePendingTransition() method, which works perfectly fine, exept for one thing: in the Settings/Dispay menu, you can choose to show no animations, some animations or all animations, and the fact is that the method only works when it is set to all animations.

有谁知道如何绕过这个问题?

Does anybody know how to bypass this problem?

非常感谢

推荐答案

你在谈论的设置是用户preferences。如果你的用户要关闭所有的动画,你为什么要找到一个解决办法,继续显示在您的应用程序的动画?这似乎不是很人性化。

The settings you're talking about are user preferences. If one of your users wanted to turn off all animations, why would you want to find a workaround to continue showing animations in your app? It doesn't seem very user-friendly.

在任何情况下, overridePendingTransition 使用之间设置动画活动,而不是查看这也是为什么你可以将其关闭部分,并在 Android 2.0的进行了介绍。没有可用的另一个SDK方法做同样的事情;但是,您可以尝试使用 LayoutAnimation 动画您提供每个活动的布局你创建。它不会是完全一样的 overridePendingTransition ,但我认为这将是你会发现一个替代最接近的事情之一。

At any rate, overridePendingTransition is used to animate between Activities, as opposed to Views which is part of why you can turn them off, and was introduced in Android 2.0. There isn't another SDK method available that does the same thing; however, you can try using a LayoutAnimation to animate the layout you provide for each Activity you're creating. It wouldn't be exactly the same as overridePendingTransition, but I think it's going to be one of the closest things you'll find to an alternative.

your_animation.xml

<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/THE_ANIMATION_YOU_WANT_TO_USE" />

your_layout.xml

android:layoutAnimation="@anim/your_animation"

这篇关于替代overridePendingTransition() - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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