-
Notifications
You must be signed in to change notification settings - Fork 1
LottieAlertDialog
Leonardo D. Palma edited this page Mar 27, 2025
·
2 revisions
Create and display an Lottie animation dialog. See Lottie
In code:
LottieAlertDialog.Builder(applicationContext)
.setAnimation(R.raw.animation_welcome) //Required or setAnimationFromUrl(url)
.setCancelable(false)
.setTimeout(10000) //Required if cancelable = false
.create()
.show()LottieAlertDialog offers several attributes for a deeper view configuration, the following table shows all these options and their default value.
| Name | Description | Values | Default | Related method(s) |
|---|---|---|---|---|
| Builder | Creates a builder for an alert dialog that uses the default alert dialog theme | Context |
N/A | Builder() |
| Animation | Sets the animation |
String, Int
|
N/A | setAnimation() |
| Animation | Sets the animation url | String |
N/A | setAnimationFromUrl() |
| Repeat | Sets the animation repeat count | Int |
N/A | setAnimationRepeatCount() |
| Speed | Sets the animation speed | Float |
N/A | setAnimationSpeed() |
| Gravity | Set gravity of the dialog |
Int [android.view.Gravity] |
N/A | setGravity() |
| Cancelable | Sets whether the dialog is cancelable or not | Boolean |
true |
setCancelable() |
| LayoutParams | Sets the layout params | Int |
N/A | setLayoutParams() |
| Timeout | Sets the timeout | Long |
N/A | setTimeout() |
| create | Creates an IOSProgressDialog with the arguments supplied to this builder | - | - | create() |
| show | Start the dialog and display it on screen | - | - | show() |
If you want to add more functionality to dialog events, you can use the following methods to capture the actions.
- When the
dismissoption is called from the dialog box, you can use thesetOnDismissListenermethod to perform additional actions. - When the
canceloption is called from the dialog box, you can use thesetOnCancelListenermethod to perform additional actions. - When the
showoption is called from the dialog box, you can use thesetOnShowListenermethod to perform additional actions. - When the
timeoutoption the dialog to automatically dismiss after a specified duration, you can use thesetTimeoutmethod.