为什么显示效果不工作按开发者博客 [英] Why Reveal effect not working as per Developer blog

查看:248
本文介绍了为什么显示效果不工作按开发者博客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有显示效果,在我的应用程序。我来了解它如何可以实现的。我从 Andoid开发者博客的信息。

I want to have Reveal Effect with in my app. I come to know about it for how it can be implemented. I got the information from the Andoid Developer Blog.

但是,当我已经更新了,在我的code,它没有显示任何效果。

But when i have updated that with in my code, it is not showing any effect.

我还与演示由谷歌给试图向世人证明显示效果。但它也没有显示效果。如果有任何允许我需要添加或什么是错我在做什么?

I have also try with Demo given by Google to demostrate Reveal effect. But it also not showing the effect. If there any permission i need to add or whats wrong i am doing?

我的动画是如下:

View button = rootView.findViewById(R.id.button);
    final View shape = rootView.findViewById(R.id.circle);
    shape.setClipToOutline(false);
    shape.setVisibility(View.INVISIBLE);
    // Set a listener to reveal the view when clicked.
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if(isShowing==false){
                // previously invisible view

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

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

                // create the animator for this view (the start radius is zero)
                Animator anim =
                        ViewAnimationUtils.createCircularReveal(shape, cx, cy, 0, finalRadius);

                // make the view visible and start the animation
                shape.setVisibility(View.VISIBLE);
                anim.setDuration(4000);
                anim.start();
            }else{

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

                // get the initial radius for the clipping circle
                int initialRadius = shape.getWidth();

                // create the animation (the final radius is zero)
                Animator anim =
                        ViewAnimationUtils.createCircularReveal(shape, cx, cy, initialRadius, 0);

                // make the view invisible when the animation is done
                anim.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        shape.setVisibility(View.INVISIBLE);
                    }
                });

                anim.setDuration(4000);
                // start the animation
                anim.start();
            }

            isShowing = !isShowing;

    }
    });

请让我知道如何实现这种效果。

Please let me know how to achieve this effect.

推荐答案

这与棒棒堂被回迁介绍并不代表一切。显示,纹波和高程是一些例子。主要的原因是,他们中的一些严重依赖于新的 UI线程介绍白衣 ART 。你可以在这里找到更多的信息 ,在最底部,在FAQ栏目

Not everything that was introduced with Lollipop was backported. Reveal, ripple and elevation are some examples. The main reason is that some of them rely heavily on the new UI Thread introduced whit ART. You can find more info here, on the very bottom, in the faq section

这篇关于为什么显示效果不工作按开发者博客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆