gpt4 book ai didi

android - setAnimation 与 android 中的 startAnimation

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:22:18 25 4
gpt4 key购买 nike

我基本上想将 View 从一个位置移动到另一个位置,而且我还想逐渐增加它的高度,那么我应该使用 setAnimation 还是 startAnimation。

TranslateAnimation ta = new TranslateAnimation(0, 0, Animation.RELATIVE_TO_SELF, -otherview.getHeight());
ta.setDuration(1000);
ta.setFillAfter(true);

myview.startAnimation(ta); //or, which one to use and what is the difference.

myview.setAnimation(ta);

问题:如何移动这个相对布局?

我尝试了 myview.scrollTo(x,y) 但没有用。是否可以逐渐增加 View 高度?

最佳答案

这是我的理解。

设置动画

当 View 添加到viewGroup时,会调用动画。当 View 已经添加时,不会调用动画

开始动画

即使添加了 View ,动画也会一直被调用。

关于android - setAnimation 与 android 中的 startAnimation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10909865/

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