https://github.com/fernandospr/android-overlay-dialog
A customizable dialog shown on top of the window
https://github.com/fernandospr/android-overlay-dialog
Last synced: 8 months ago
JSON representation
A customizable dialog shown on top of the window
- Host: GitHub
- URL: https://github.com/fernandospr/android-overlay-dialog
- Owner: fernandospr
- License: mit
- Created: 2017-07-05T15:26:13.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-09T15:33:20.000Z (almost 9 years ago)
- Last Synced: 2025-07-22T05:04:11.551Z (11 months ago)
- Language: Java
- Size: 11.7 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# android-overlay-dialog
A customizable dialog shown on top of the window. Useful for showing info/error messages.
## Sample app

## How to use
Please, add the following dependency to your gradle file:
```
compile 'com.github.fernandospr:overlaydialog:1.0.1'
```
`OverlayDialog` inherits from `android.app.Dialog`, so you can use the same methods from Dialog, for example:
```
OverlayDialog dialog = new OverlayDialog(this);
dialog.setCancelable(true);
...
dialog.show();
...
dialog.dismiss();
```
To customize the view for the dialog, you should use:
```
View customView = LayoutInflater.from(this).inflate(layoutResID, root, false);
...
dialog.setContentView(customView);
```
To customize the auto dismiss time, you should use:
```
dialog.setAutoDismissDelayMillis(5000);
```
To customize the enter/exit animations, you should create a theme and set it in the constructor, for example:
```
OverlayDialog dialog = new OverlayDialog(this, R.style.TopMessageDialog);
```
* res/values/styles.xml
```
<item name="android:windowAnimationStyle">@style/TopMessageDialogAnimation</item>
<item name="android:windowEnterAnimation">@anim/translate_from_top</item>
<item name="android:windowExitAnimation">@anim/translate_to_top</item>
```
* res/anim/translate_from_top.xml
```
```
* res/anim/translate_to_top.xml
```
```
See the sample app for more examples.