I want to show a dialog on my activity with animation. My dialog will slide from bottom of activity to middle of activity.
/****Edit****/
I\'m sorry for my q
Here is the simplest way to animate dialog when showing
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
View view = dialog.getWindow().getDecorView();
//for enter from left
//ObjectAnimator.ofFloat(view, "translationX", -view.getWidth(), 0.0f).start();
//for enter from bottom
ObjectAnimator.ofFloat(view, "translationY", view.getHeight(), 0.0f).start();
}
});
In addition to it, make dialog background full screen and transparent when animating from bottom
Window window = dialog.getWindow();
window.setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
window.setBackgroundDrawableResource(android.R.color.transparent);