Android 增加半径的圆形隐藏-动画
我知道如何使用CircularVeal来显示视图,所以我正在寻找一种类似“CircularHide”的方法。换句话说,我希望在使视图可见后通过圆形动画(增加半径)使其不可见。我该怎么做 我写这篇文章是为了揭示:Android 增加半径的圆形隐藏-动画,android,android-studio,android-animation,Android,Android Studio,Android Animation,我知道如何使用CircularVeal来显示视图,所以我正在寻找一种类似“CircularHide”的方法。换句话说,我希望在使视图可见后通过圆形动画(增加半径)使其不可见。我该怎么做 我写这篇文章是为了揭示: private void startCircularReveal() { RelativeLayout changeableLayout = findViewById(R.id.layoutChangeable); int centerX = (likeB
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();
}
将转换api用于可见性更改动画。到目前为止,我还没有找到这个问题的任何答案,我决定更改设计。因此,我用@ashakirov所说的“可见性更改动画”更改了“圆形隐藏”(一个变大并使其他视图透明的圆圈)。如果你有任何进一步的技巧,请与我分享。