android – 为前棒棒糖设备创建循环显示

前端之家收集整理的这篇文章主要介绍了android – 为前棒棒糖设备创建循环显示前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

首先,这是与Create circular reveal for pre-Lollipop devices (Android)不同的问题

我正在使用那里提到的库来创建Circular Reveal,但它似乎对我不起作用.

XML

JAVA

                View myView = findViewById(R.id.circBack);


                // get the center for the clipping circle
                int cx = (myView.getLeft() + myView.getRight()) / 2;
                int cy = (myView.getTop() + myView.getBottom()) / 2;

                // get the final radius for the clipping circle
                int finalRadius = Math.max(myView.getWidth(),myView.getHeight());


                SupportAnimator animator = ViewAnimationUtils.createCircularReveal(myView,cx,cy,finalRadius);
                animator.setInterpolator(new AccelerateDecelerateInterpolator());
                animator.setDuration(1000);
                myView.setVisibility(View.VISIBLE);
                animator.start();

圆形揭示没有显示出来.我的意思是代码执行时没有任何反应.

Logcat显示了这一点

07-01 19:15:47.498  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on prevIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.Class502  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on prevIoUsly-Failed class java.lang.Class502  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on prevIoUsly-Failed class java.lang.Class502  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on prevIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.ClassIoUsly-Failed class java.lang.Class

但是,如果将视图设置为在XML文件中可见,则圆形显示确实有效,但问题是如果我将视图“circBack”设置为在XML中可见,它从应用程序启动时开始显示,这通常是.

任何解决这个问题的方法

最佳答案
看起来你正在“Gone”视图中初始化这个动画?

尝试获得视图的可见性,并确保在内部运行它

if (mView.getVisibility() == View.VISIBLE)
{
..
..
  anim.start();
}

代码块.

原文链接:https://www.f2er.com/android/431286.html

猜你在找的Android相关文章