Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-setDuration不工作?物体动画师_Android_Animation - Fatal编程技术网

Android-setDuration不工作?物体动画师

Android-setDuration不工作?物体动画师,android,animation,Android,Animation,我正在尝试使用ObjectAnimator向下移动图像视图。setDuration()方法似乎不会影响动画的持续时间。我无法在XML中设置此动画,因为我希望动态播放此动画 ObjectAnimator an= ObjectAnimator.ofFloat(img, View.TRANSLATION_Y, 0, 100); an.setDuration(5000); an.start(); 这里有点离题,但如果我想在彼此之后播放不止一个ObjectAnimation,有没

我正在尝试使用ObjectAnimator向下移动图像视图。setDuration()方法似乎不会影响动画的持续时间。我无法在XML中设置此动画,因为我希望动态播放此动画

    ObjectAnimator an= ObjectAnimator.ofFloat(img, View.TRANSLATION_Y, 0, 100);
    an.setDuration(5000);
    an.start();
这里有点离题,但如果我想在彼此之后播放不止一个ObjectAnimation,有没有办法做到这一点?我看过动画师集,但我不确定它是否会像对象动画师一样移动实际对象,而不是像在TranslateImation中那样出现


提前谢谢

也许您正在三星设备上测试?在这种情况下,在“开发人员选项”下有一个默认设置为“关闭”的选项Animator duration scale。如果切换到“正常”值,则可以看到动画

希望对您有所帮助。

LayoutInflater充气机=(LayoutInflater) getSystemService(上下文布局\充气机\服务)


请创建一个。对于连续动画,请查看
AnimatorSet
。好的,我已经尽力了。没有,但是我禁用了Animator持续时间刻度。现在可以了,谢谢你的帮助。现在有没有一种方法可以让我为视图设置动画,而不受Animator持续时间比例的影响?因此,基本上,如果我确实使用Animator.setDuration向我的应用程序添加动画,并且有人禁用了Animator持续时间比例,他将看到,事情进展是否非常快?
    final View popupView = inflater.inflate(R.layout.loading_popup, null,false);
    popup = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
    popup.setContentView(popupView);
    popup.setOutsideTouchable(true);
    ImageView loadingPlane=(ImageView)popupView.findViewById(R.id.loading_plane);

    RotateAnimation anim = new RotateAnimation(0.0f, 360.0f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    // Step 2:  Set the Animation properties
    anim.setInterpolator(new LinearInterpolator());
    //anim.setRepeatCount(Animation.INFINITE);

    anim.setRepeatCount(-1);
    anim.setDuration(1500);
    loadingPlane.startAnimation(anim);

    findViewById(R.id.flyinstyle).post(new Runnable() {
        public void run() {
            popup.showAtLocation(findViewById(R.id.flyinstyle), Gravity.CENTER, 0, 0);
        }
    });