半径增加的圆形皮革-动画

时间:2020-10-14 15:45:00

标签: android android-studio android-animation

我知道如何使用CircularReveal来显示视图,因此我正在寻找一种方法来做类似“ CircularHide”的事情。换句话说,我想在使其可见后通过圆形动画(半径增大)使视图不可见。我该怎么办?

我写这是为了揭示:

private void startCircularReveal() {
        RelativeLayout changeableLayout = findViewById(R.id.layoutChangeable);
        int centerX = (likeButton.getRight() + likeButton.getLeft()) / 2;
        int centerY = (likeButton.getBottom() + likeButton.getTop()) / 2;
        float endRadius = (float) Math.hypot(changeableLayout.getWidth(), changeableLayout.getHeight());

        changeableLayout.setVisibility(View.VISIBLE);
        Animator revealAnimator = ViewAnimationUtils.createCircularReveal(changeableLayout,
                centerX, centerY, 0, endRadius);
        revealAnimator.setDuration(200).start();
}

0 个答案:

没有答案
相关问题