MotionSpec.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:material-components-android 作者:
/** Inflates an instance of MotionSpec from the given animator resource. */
@Nullable
public static MotionSpec createFromResource(Context context, @AnimatorRes int id) {
  try {
    Animator animator = AnimatorInflater.loadAnimator(context, id);
    if (animator instanceof AnimatorSet) {
      AnimatorSet set = (AnimatorSet) animator;
      return createSpecFromAnimators(set.getChildAnimations());
    } else if (animator != null) {
      List<Animator> animators = new ArrayList<>();
      animators.add(animator);
      return createSpecFromAnimators(animators);
    } else {
      return null;
    }
  } catch (Exception e) {
    Log.w(TAG, "Can't load animation resource ID #0x" + Integer.toHexString(id), e);
    return null;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号