Skip to content

Instantly share code, notes, and snippets.

@zakrodionov
Forked from orhanobut/gist:8665372
Last active June 13, 2019 12:09
Show Gist options
  • Save zakrodionov/52c8722d3f0d2f1b8fcce19a7bde6189 to your computer and use it in GitHub Desktop.
Save zakrodionov/52c8722d3f0d2f1b8fcce19a7bde6189 to your computer and use it in GitHub Desktop.
Up down animation for dialog fragment / Выезжает снизу #view #animation
// Slide up animation
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="0" />
</set>
// Slide dowm animation
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:toYDelta="100%p" />
</set>
// Style
<style name="DialogAnimation">
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
// Inside Dialog Fragment
@Override
public void onActivityCreated(Bundle arg0) {
super.onActivityCreated(arg0);
getDialog().getWindow()
.getAttributes().windowAnimations = R.style.DialogAnimation;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment