如何使用默认的动画在Android的? [英] How to use default animations in Android?

查看:180
本文介绍了如何使用默认的动画在Android的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用默认的动画与片段活动..在这里我发现了一些关于它的:

I'm trying to use the default animations for the Activity with fragments.. here I found something about it:

<一个href=\"http://stackoverflow.com/questions/14376810/android-using-activitys-default-animation-for-fragments\">Android:使用活动的默认动画片段

问题是:好的,我需要(例如)activityOpenEnterAnimation..我如何使用它

the problem is: ok, I need (for example) "activityOpenEnterAnimation".. how can I use it?

使用以下code将无法工作:

Using the following code won't work:

        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.setCustomAnimations(android.R.anim.activityOpenEnterAnimation, android.R.anim.activityOpenExitAnimation);

        transaction.replace(R.id.container, fragment)
                .addToBackStack(((Object) fragment).getClass().getName())
                .commit();

提示?谢谢! :)

Hints? Thanks! :)

推荐答案

目前,Android的文档明确建议不要直接使用资源从 android.R。* ,因为每个该平台发布对他们的变化。即使是一些资源dissapear从一个版本到另一个,所以你不应该依靠他们。在另一方面,大量的资源是从开发人员的code私人和不可用的。

Nowadays, Android documentation clearly recommends not to use resources directly from android.R.*, since every release of the platform has changes on them. Even some resources dissapear from one version to another, so you shouldn't rely on them. On the other hand, lots of resources are private and not available from a developer's code.

最安全(推荐)的方法是简单地复制和放大器;从您希望到您自己的code了Android版本的源$ C ​​$ C粘贴你需要的资源(在这种情况下,动画),并通过定期的研究使用它们。*

The safest (and recommended) way is to simply copy & paste the resources you need (in this case, the animations) from the source code of the Android version you want into your own code, and use them through the regular R.*.

您可以浏览Android源$ C ​​$ C在许多方面,如在解释[1]。

You can browse the Android source code in many ways, as explained in [1].

[1] <一个href=\"http://stackoverflow.com/questions/449763/where-can-i-browse-android-source-$c$c-on-line\">Where我可以在网上浏览Android源$ C ​​$ C?

这篇关于如何使用默认的动画在Android的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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