-
-
Save zakrodionov/21d090eee43d8357fc2aed0b4609c561 to your computer and use it in GitHub Desktop.
DialogFragment enter/exit animations #view #animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example courtesy of http://adilatwork.blogspot.com/2012/11/android-dialogfragment-enter-and-exit.html | |
// file location: src/main/java/com/example/ | |
@Override | |
public void onStart() { | |
super.onStart(); | |
// safety check | |
if (getDialog() == null) { | |
return; | |
} | |
// set the animations to use on showing and hiding the dialog | |
getDialog().getWindow().setWindowAnimations( | |
R.style.dialog_animation_fade); | |
// alternative way of doing it | |
//getDialog().getWindow().getAttributes(). | |
// windowAnimations = R.style.dialog_animation_fade; | |
// ... other stuff you want to do in your onStart() method | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
courtesy of http://adilatwork.blogspot.com/2012/11/android-dialogfragment-enter-and-exit.html | |
file location: src/main/res/anim | |
--> | |
<alpha | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:interpolator="@android:anim/accelerate_interpolator" | |
android:fromAlpha="0.0" | |
android:toAlpha="1.0" | |
android:duration="400" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
courtesy of http://adilatwork.blogspot.com/2012/11/android-dialogfragment-enter-and-exit.html | |
file location: src/main/res/anim | |
--> | |
<alpha | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:interpolator="@android:anim/decelerate_interpolator" | |
android:fromAlpha="1.0" | |
android:toAlpha="0.0" | |
android:duration="400" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
courtesy of http://adilatwork.blogspot.com/2012/11/android-dialogfragment-enter-and-exit.html | |
file location: src/main/res/values | |
--> | |
<style | |
name="dialog_animation_fade" > | |
<item name="android:windowEnterAnimation">@anim/fade_in_dialog</item> | |
<item name="android:windowExitAnimation">@anim/fade_out_dialog</item> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment