Wenn Sie eine benutzerdefinierte Ansicht (definiert in einem XML) haben, können Sie dies versuchen:
AlertDialog a = new AlertDialog.Builder(this)...blablabla;
View v = a.findViewById(R.layout.example);
// get the center for the clipping circle
int cx = (v.getLeft() + v.getRight())/2;
int cy = (v.getTop() + v.getBottom())/2;
// get the final radius for the clipping circle
int finalRadius = Math.max(v.getWidth(), v.getHeight());
// create the animator for this view (the start radius is zero)
Animator anim = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius);
// make the view visible and start the animation
v.setVisibility(View.VISIBLE);
anim.start();
So blenden sie die umgekehrte Animation mit:
View v = <yourAlertDialog>.findViewById(R.layout.example);
// get the center for the clipping circle
int cx = (v.getLeft() + v.getRight())/2;
int cy = (v.getTop() + v.getBottom())/2;
// get the initial radius for the clipping circle
int initialRadius = v.getWidth();
// create the animation (the final radius is zero)
Animator anim = ViewAnimationUtils.createCircularReveal(v, 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);
v.setVisibility(View.INVISIBLE);
}
});
// start the animation
anim.start();
Was würden Sie vorschlagen, für eine ähnliche Animation für API-Ebene < 21? –