Android的大号显示效果不工作

编程入门 行业动态 更新时间:2024-10-12 03:20:45
本文介绍了Android的大号显示效果不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图执行 createCircularReveal()在 FloatingButton 。但动画实在是太快了。如何增加动画的持续时间。我试过 setDuration(毫秒),但它不工作。

我跟developer.android,定义自定义动画

下面我code:

INT CX =(fabBtn.getLeft()+ fabBtn.getRight())/ 2; INT CY =(fabBtn.getTop()+ fabBtn.getBottom())/ 2; INT finalRadius = Math.max(fabBtn.getWidth(),fabBtn.getHeight()); 动画动画= ViewAnimationUtils.createCircularReveal(fabBtn,CX,CY,2,finalRadius); anim.setDuration(2000); fabBtn.setVisibility(View.VISIBLE); anim.start();

解决方案

我也面临这个问题,因为我提到的,我能够通过让CX来解决这个问题,CY的图像视图的中心位置(在你的情况我认为这是按钮)。 因此,让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;

I tried to implement createCircularReveal() in FloatingButton. But the animation is too fast. How to increase the duration of the Animation. I tried setDuration(milli-seconds), But its not working.

I follow developer.android, Defining Custom Animations

Here my code:

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();

解决方案

I am also facing the issue as I mentioned and I am able to resolve this issue by getting cx and cy the center position for image view (In your case I think it is button). So get cx and cy using this:

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

Instead of this::

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

更多推荐

Android的大号显示效果不工作

本文发布于:2023-11-29 14:01:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646593.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大号   显示效果   工作   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!