Skip to main content

Top Android AlertDialog Libraries

Here are some fo the best android alert dialog libraries. Use these to implement beautiful alert dialogs in your app easily.

(a). FancyAlertDialog

FancyAlertDialog-Android is an Android library that allows you to create beautiful and customizable alert dialogs in your Android application.

Here is a demo screenshot:

How to add to your project?

To add FancyAlertDialog-Android library to your project, you need to add the following dependency to your module's build.gradle file:

implementation 'com.github.Shashank02051997:FancyAlertDialog-Android:0.3'

You also need to add JitPack repository to your root build.gradle file.

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

This library offers various features such as customizable color and text, pre-defined animations, icon support, positive and negative button support, and more.

Usage

Here is an example of its use:

 FancyAlertDialog.Builder
.with(this)
.setTitle("Rate us if you like the app")
.setBackgroundColor(Color.parseColor("#303F9F")) // for @ColorRes use setBackgroundColorRes(R.color.colorvalue)
.setMessage("Do you really want to Exit ?")
.setNegativeBtnText("Cancel")
.setPositiveBtnBackground(Color.parseColor("#FF4081")) // for @ColorRes use setPositiveBtnBackgroundRes(R.color.colorvalue)
.setPositiveBtnText("Rate")
.setNegativeBtnBackground(Color.parseColor("#FFA9A7A8")) // for @ColorRes use setNegativeBtnBackgroundRes(R.color.colorvalue)
.setAnimation(Animation.POP)
.isCancellable(true)
.setIcon(R.drawable.ic_star_border_black_24dp, View.VISIBLE)
.onPositiveClicked(dialog -> Toast.makeText(MainActivity.this, "Rate", Toast.LENGTH_SHORT).show())
.onNegativeClicked(dialog -> Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show())
.build()
.show();

Customizations

  • You can customize the background color of the dialog box by using setBackgroundColor(Color.parseColor("#303F9F")) or setBackgroundColorRes(R.color.colorvalue) methods.

  • There are three pre-defined animations available in FancyAlertDialog-Android: POP, SLIDE, and SIDE. You can use them by using .setAnimation(Animation.POP), .setAnimation(Animation.SLIDE), or .setAnimation(Animation.SIDE) methods.

  • You can add an icon to the dialog box by using setIcon(R.drawable.ic_star_border_black_24dp, View.VISIBLE) method. The first parameter is the drawable resource and the second parameter is the visibility of the icon.

  • You can handle positive and negative button clicks on the dialog box by using onPositiveClicked() and onNegativeClicked() methods. You can provide the desired behavior in the lambda function.

It seems to be a useful library for Android developers who want to create beautiful and customizable alert dialogs in their applications. You can customize the look and feel of the dialog box, add animations, icons, and handle button clicks easily. To learn more about FancyAlertDialog-Android, please visit the GitHub page at https://github.com/Shashank02051997/FancyAlertDialog-Android.