--ADVERTISEMENT--

Alert dialog is one of the important user interfaces (UI) design component in android application. An alert dialog box is a small window where users decide some decision or enter some information. If you want to display an alert dialog box to your application with animation effect you are here in right place. In this tutorial, you will learn to display material design alert dialog box in your app with animation effect.

Dialog box is also used to display message at the time of getting error or new updates about the application. It’s simple to display dialog in android just follow following simple steps.

Related:
Simple Android Alert Dialog Example
Android Custom Alert Dialog Example
Android Toast - How to Display Simple Toast Message in Android

Android Example: How to Make Material Design Animated Dialog Box


First you have to add dependency in you project, for that open build.gradle file of your application and add compile 'com.nineoldandroids:library:2.4.0' and
compile 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:[email protected]' as project dependency. Build.gradle file will looks like below.

build.gradle

Open your app XML layout file and add some buttons with different onClick attributes. Here, I have added four buttons with onClick attribute animatedDialog1, animatedDialog2, animatedDialog3, animatedDialog4. XML layout file will looks like below.

res/layout/animated_android_dialog_box.xml

Now, this is time to work with java code. Open your app java activity file and add dialog title text, message text, dialog box color, button text, and effect type like the below.

src/AnimatedAndroidDialogExample.java

You can use other different effects like Slideleft, SlideBottom, Fadein, Newspaper, RotateBottom, RotateLeft, Slit.

Android Example: How to Make Material Design Animated Dialog Box

Run your Material Design Android Animated Alert Dialog Box Example application and click on the buttons, you will see dialog box with different animation effect. If you need other types of animation you can use above animation effects.

Post a Comment

Powered by Blogger.