gpt4 book ai didi

Android L reveal 效果不工作

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

我试图在 FloatingButton 中实现 createCircularReveal()。但是动画太快了。如何增加动画的持续时间。我尝试了 setDuration(milli-seconds),但它不起作用。

我关注 developer.android.com,Defining Custom Animations

这是我的代码:

int cx = (fabBtn.getLeft() + fabBtn.getRight()) / 2;
int cy = (fabBtn.getTop() + fabBtn.getBottom()) / 2;

int finalRadius = Math.max(fabBtn.getWidth(), fabBtn.getHeight());
Animator anim = ViewAnimationUtils.createCircularReveal(fabBtn, cx, cy, 2, finalRadius);
anim.setDuration(2000);
fabBtn.setVisibility(View.VISIBLE);
anim.start();

最佳答案

我也遇到了我提到的问题,我可以通过让 cx 和 cy 成为 ImageView 的中心位置来解决这个问题(在你的情况下,我认为它是按钮)。
所以使用这个获取 cx 和 cy:

int cx = (fabBtn.getWidth()) / 2;
int cy = (fabBtn.getHeight()) / 2;

代替这个::

int cx = (fabBtn.getLeft() + fabBtn.getRight()) / 2;
int cy = (fabBtn.getTop() + fabBtn.getBottom()) / 2;

关于Android L reveal 效果不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27518327/

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