What are the actual ms time values for Android'

2019-01-30 08:33发布

问题:

Android includes

config_longAnimTime
config_mediumAnimTime
config_shortAnimTime

but the actual values identified by these constants don't make sense as milliseconds. I'm sure they get compiled into useful values, and I can determine them with code, but I'm sure someone else knows the answer - and, more to the point, I'm sure other people will be looking for them. So please post the actual values as an answer and save everyone a little bit of time.

回答1:

Current values (since 3.x):

  • config_shortAnimTime=200
  • config_mediumAnimTime=400
  • config_longAnimTime=500

And the duration of the activity open/close and fragment open/close animations:

  • config_activityShortDur=150
  • config_activityDefaultDur=220


回答2:

Here we go:

config_longAnimTime   = 400
config_mediumAnimTime = 300
config_shortAnimTime  = 150


回答3:

Directly read the property:

getResources().getInteger(android.R.integer.config_shortAnimTime);
getResources().getInteger(android.R.integer.config_mediumAnimTime);
getResources().getInteger(android.R.integer.config_longAnimTime);


回答4:

For anyone using java code for create and start animation.
The default duration for a animation is 300

public class ValueAnimator extends Animator implements AnimationHandler.AnimationFrameCallback {
    ...
    // How long the animation should last in ms
    private long mDuration = 300;
}