title: Popup Window animation changed programatically in Android
body: <p>I already have a <code>PopupWindow</code> and a defined XML scale animation in <code>res/anim/</code> that is applied on show and on dismiss of that popup window. But the case is I want to change <code>pivotX</code> and <code>pivotY</code> of the style of animation dynamically so it starts (grows) from different points of the screen.</p>
  
  <p>So either I'm able change <code>pivotX</code> and <code>pivotY</code> dynamically in <code>res/anim/in.xml</code> or create new <code>ScaleAnimation</code> and apply it. I cannot see how to do the first option, and unfortunately the latter doesn't work when I write:</p>
  
  <pre><code>public class MyPopup {
  
      private PopupWindow popupWindow;
  
      private Integer growFromX;
      private Integer growFromY;
  
      public MyPopup(Integer growFromX, Integer growFromY) {
          if (growFromX != null &amp;&amp; growFromY != null) {
              this.growFromX = growFromX.intValue();
              this.growFromY = growFromY.intValue();
          }
      }
  
      public void show() {
          LayoutInflater layoutInflater = (LayoutInflater) this.activity
                  .getBaseContext().getSystemService(
                          Activity.LAYOUT_INFLATER_SERVICE);
          View popupView = layoutInflater.inflate(
                  R.layout.map_selector_dialog_layout, null);
  
          ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 0.0f,
                  1.0f, 1.0f, Animation.RELATIVE_TO_SELF,
                  (float) this.growFromX, Animation.RELATIVE_TO_SELF,
                  (float) this.growFromY);
          scaleAnimation.setFillAfter(false);
          scaleAnimation.setDuration(4000);
          popupView.setAnimation(scaleAnimation);
  
          this.popupWindow = new PopupWindow(popupView, 
              LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  
          this.popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
      }
  
  }
  </code></pre>
  
  <p>It doesn't have to be WindowPopup. I can use <code>Dialog</code> or whatever so I can I achieve such a behaviour. Could you help? </p>