gpt4 book ai didi

Android setAnimation 直接触发

转载 作者:行者123 更新时间:2023-11-30 03:14:11 25 4
gpt4 key购买 nike

您好,我正在使用以下内容:

        final ImageView ivLoading3 = new ImageView(context);
ivLoading3.setBackgroundResource(com.example.testtabswipe.R.drawable.dot_loading);
ivLoading3.setLayoutParams(layoutParams);
final TranslateAnimation mAnimation3 = new LoadingTranslateAnimation(
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.2f);
((LinearLayout) view).addView(ivLoading3);
ivLoading3.setAnimation(mAnimation3); // <--- firing off directly

我希望它不要直接触发。有什么我想念的吗?

据我了解,startAnimation 用于直接触发,而 setAnimation 只是设置它但不触发它。我在这里误解了什么?

来自 http://developer.android.com/reference/android/view/View.html#setAnimation(android.view.animation.Animation) 的官方文档:

public void setAnimation (Animation animation) Sets the next animation to play for this view. If you want the animation to play immediately, use startAnimation(android.view.animation.Animation) instead. This method provides allows fine-grained control over the start time and invalidation, but you must make sure that 1) the animation has a start time set, and 2) the view's parent (which controls animations on its children) will be invalidated when the animation is supposed to start.

最佳答案

setAnimation

Sets the next animation to play for this view.But view animation doesnot start yet.

startAnimation

If you want the animation to play immediately, use startAnimation.This method provides allows fine-grained control over the start timeand invalidation, but you must make sure that

  1. the animation has a start time set,

  2. the view will be invalidated when the animation is supposed tostart.

来自 here

关于Android setAnimation 直接触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20441453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com