title: Applying Android Dialog Animations?
body: <p>I want to set animation to my Dialog.  The challenge here is that I want to do this programatically.  </p>
  
  <p>The reason for that is I have too many different size of dialogs and I don't want to create a new <code>animation</code> file for each type of dialog.</p>
  
  <p>As of now, this if what I am doing:</p>
  
  <p><strong><code>res/anim/anim_myDialog_SlideUp.xml</code> file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"&gt;
  
     &lt;translate android:fromXDelta="0%"
          android:toXDelta="0%"
          android:fromYDelta="200%" 
          android:toYDelta="0%"
          android:duration="400"/&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p><strong><code>res/anim/anim_myDialog_SlideDown.xml</code> file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"&gt;
  
     &lt;translate android:fromXDelta="0%"
          android:toXDelta="0%"
          android:fromYDelta="0" 
          android:toYDelta="200%"
          android:duration="400"/&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p><strong>In my <code>res/values/styles.xml</code> file:</strong></p>
  
  <pre><code>&lt;style name="slideUpAndDown"&gt;
      &lt;item name="android:windowEnterAnimation"&gt;@anim/anim_myDialog_SlideUp&lt;/item&gt;
      &lt;item name="android:windowExitAnimation"&gt;@anim/anim_myDialog_SlideDown&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="myDialogSlideUpAndDown" parent="@android:style/Theme.Dialog"&gt;
      &lt;item name="android:windowAnimationStyle"&gt;@style/slideUpAndDown&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p><strong>In my <code>MainActivity.cs</code> file:</strong>  </p>
  
  <pre><code>Dialog myDialog = new Dialog(this, Resource.Style.myDialogSlideUpAndDown);
  </code></pre>
  
  <p>I can create the animations programmatically with no problem.  The problem is how can I set those animations to my Dialog?</p>
  
  <p>If I create a <code>Dialog</code> and not set it's style in the constructor:</p>
  
  <pre><code>Dialog myDialog = new Dialog(this);
  </code></pre>
  
  <p>Then I have the option to do this to set it's animation:</p>
  
  <pre><code>myDialog.Window.SetWindowAnimations(int);
  </code></pre>
  
  <p><code>SetWindowAnimations</code> requires an <code>int</code>.  Can I create this animation <code>int</code> manually?</p>
  
  <p>Sorry for the long explanation and thank you for your time.</p>