/** 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;
}
}
MotionSpec.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:material-components-android
作者:
评论列表
文章目录