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
I tried all the answers in here and it don't work for me. I know all that answers are written long time ago. So let me show how I get it to work. I followed this article.
In short : create res/anim/slide_up.xml
then, create res/anim/slide_bottom.xml
Then add a style in res/values/styles.xml
Now you can set this animation style to your dialog or alertdialog box like below.
Dialog dialog = new Dialog(this);
dialog.getWindow().getAttributes().windowAnimations = animationSource;
Or,
Dialog dialog = new Dialog(this);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM;
lp.windowAnimations = R.style.DialogAnimation;
dialog.getWindow().setAttributes(lp);
I showed example only for dialog boxes, but as I said before you can use this method for alert dialog boxes too.