问题描述
我正在为我的应用程序使用 Transitions-Everywhere ,我想知道是否可以设置过渡的速度/时间.
I'm using Transitions-Everywhere for my app, and I wonder if I can set the transition speed/time of the transitions..
我有这样的东西:
TransitionManager().beginDelayedTransition(animLayout, new ChangeBounds());
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) findViewById(R.id.myId).getLayoutParams();
layoutParams.height = (int) myHeight;
layoutParams.width = (int) myWidth;
myLayout.setLayoutParams(layoutParams);
简而言之,我希望转换速度比默认速度慢,但是我只是不知道如何设置转换速度!
In short, I want the transition to be slower than the default, but I just can't figure out how to set the speed of the transition!
推荐答案
您可以在传递给 beginDelayedTransition()
的 Transition
上设置持续时间.您的情况是 ChangeBounds
.所以尝试这样的事情:
You can set the duration on the Transition
you pass into beginDelayedTransition()
. In your case that would be ChangeBounds
. So try something like this:
final ChangeBounds transition = new ChangeBounds();
transition.setDuration(600L); // Sets a duration of 600 milliseconds
TransitionManager().beginDelayedTransition(animLayout, transition);
默认情况下,如果未设置任何持续时间,则 Transition
会退回到默认动画持续时间300ms.因此,例如,如果您希望转换花费两倍的时间,请使用600ms.
By default if no duration is set a Transition
falls back to the default animation duration which is 300ms. So for example if you want the transition to take twice as long, use 600ms.
这篇关于是否有可能在Android的任何地方设置过渡速度/过渡时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!