ObjectAnimator.setDuration is ignored

风格不统一 提交于 2019-12-10 16:39:34

问题


The setDuration function of the ObjectAnimator class in Android appears to be completely ignored. No matter what value I pass it, the animation is always completed instantly.

    ObjectAnimator.ofFloat(mView, "translationY", 0, 100)
            .setDuration(2000)
            .start();

The above code increases the Y value of mView by 100 (essentially pushing it further down the screen). The actual translation occurs correctly, however it is instantaneous. The setDuration(2000) is completely ignored. Why is this?

EDIT:

This seemsto be based on the device - the samsung galaxy s4 appears to have an issue with interpolating views correctly. This is the same issue as this question.


回答1:


This turned out to be an issue with the default animation duration scale under Developer Options. I've answered a similar question here.



来源:https://stackoverflow.com/questions/30377184/objectanimator-setduration-is-ignored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!