title: android animation scale only top portion of the image
body: <p>Is it possible to scale only the top portion of a patch 9 image.</p>
  
  <p>I am using two set of images inside a frame layout.</p>
  
  <p>My objective is to animate scale an
     image(imageView2) to show the
     progress of a battery charge.(Its a
     <strong>patch 9</strong> image created to scale vertically.
  <a href="http://dl.dropbox.com/u/299320/android-drawables/1.5/battery_charge_fill_empty.9.png" rel="nofollow">imageView2</a></p>
  
  <p>Against the background of a second image (vertical battery cell)
  <a href="http://dl.dropbox.com/u/299320/android-drawables/2.1/battery_charge_background.png" rel="nofollow">imageView1</a></p>
  
  <p>I have pasted the code that i am using currently.Currently The image stretches in both directions(on the y coordinates) and the bottom round corners loses its shape and drops outside the background at the bottom.</p>
  
  <p>I want to retain the bottom round shape intact.
  And please tell me how i can limit the scaling to be within the bounds of the background image.</p>
  
  <pre><code>    &lt;FrameLayout android:layout_width="wrap_content"
              android:layout_height="fill_parent" android:layout_gravity="right"&gt;
  
              &lt;ImageView android:layout_width="wrap_content" android:id="@+id/imageView1"
                  android:layout_gravity="bottom" android:layout_height="wrap_content"
                  android:src="@drawable/battery_charge_background"&gt;&lt;/ImageView&gt;
          &lt;ImageView android:layout_width="wrap_content" android:id="@+id/imageView2"
                   android:layout_gravity="bottom"
  
                  android:layout_height="wrap_content" 
                  android:src="@drawable/battery_charge_fill_empty"
                  &gt;&lt;/ImageView&gt; 
  </code></pre>
  
  <p></p>
  
  <pre><code>ScaleAnimation scale = new ScaleAnimation((float)1.0, (float)1.0, (float)1.0, (float)8.0, Animation.RELATIVE_TO_SELF, (float)0.8, Animation.RELATIVE_TO_SELF, (float)0.7);
  scale.setFillAfter(true);
  scale.setDuration(1000);
  imageView.startAnimation(scale); 
  </code></pre>