2

I am working with a customDialog and i am trying a shown animation. I write some anim xml but when i call dialog not working.

Dialog Call Method

void openDiaog(){
    Dialog dialog = new Dialog(MainActivity.this,android.R.style.Theme_Holo_Light_NoActionBar_Fullscreen);
    dialog.setContentView(R.layout.cdialog);
    dialog.setTitle("Dialog");
    dialog.getWindow().setWindowAnimations(R.style.DialogTheme);

    /*  I try this but result is same!
    dialog.getWindow().getAttributes().windowAnimations =
    */

    dialog.show();
}

Slide Left Anim

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="100%p" android:toXDelta="0"
    android:duration="500" />

Slide Right Anim

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="500"
    android:fromXDelta="0"
    android:toXDelta="100%p" />

Animation Theme

<style name="DialogTheme">
    <item name="android:windowEnterAnimation">@anim/slide_left</item>
    <item name="android:windowExitAnimation">@anim/slide_right</item>
</style>
Emre Erol
  • 470
  • 1
  • 7
  • 25

1 Answers1

0

Try this. It will animation inner views

((ViewGroup)dialog.getWindow().getDecorView()).getChildAt(0).startAnimation(AnimationUtils.loadAnimation(context,android.R.anim.slide_in_left));
Soheil Setayeshi
  • 2,343
  • 2
  • 31
  • 43