मैं ऐसी ही कुछ किया:
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();
रिवर्स एनीमेशन का उपयोग कर इसे छुपाने के लिए संवाद दिखाने से पहले संवाद setOnShowListener
। मैं अभी भी एनीमेशन परिष्कृत करने की आवश्यकता है, लेकिन यह एक शुरुआत है: प्रकट
dialogToAnimate.setOnShowListener(new OnShowListener() {
@Override public void onShow(DialogInterface dialog) {
// Remember that ViewAnimationUtils will not work until API 21.
final View view = dialogToAnimate.getWindow().getDecorView();
final int centerX = view.getWidth()/2;
final int centerY = view.getHeight()/2;
// TODO Get startRadius from FAB
// TODO Also translate animate FAB to center of screen?
float startRadius = 20;
float endRadius = view.getHeight();
Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);
animator.setDuration(1000);
animator.start();
}
});
स्रोत
2016-01-21 16:08:06
आप एपीआई स्तर के लिए एक समान एनीमेशन के लिए क्या सुझाव है < 21? –