Animation with State List Drawable Issue
<p>I am using a <a href="http://developer.android.com/reference/android/widget/Gallery.html" rel="nofollow">Gallery</a> view.  </p>

<p>I have an onItemSelectedListener defined on the Gallery.  When an item is selected I scale the Item, using a Scale animation (defined below listener code).  </p>

<pre><code>featuredGallery.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener {
     Animation grow = null;
     View lastView = null;

     public FeaturedSelectListener(Context c) {
         grow = AnimationUtils.loadAnimation(c, R.anim.featured_selected);

         public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
         // Shrink the view that was zoomed
         if (null != lastView) {
             lastView.clearAnimation();
         }

         // Zoom the new selected view
         view.startAnimation(grow);

         // Set the last view so we can clear the animation
         lastView = view;
    }
}
</code></pre>

<p>Selected.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;scale xmlns:android="http://schemas.android.com/apk/res/android"
   android:fromXScale="1.0"
   android:toXScale="1.3"
   android:fromYScale="1.0"
   android:toYScale="1.3"
   android:duration="100"
   android:pivotY="50%"
   android:pivotX="50%"
   android:interpolator="@android:anim/accelerate_decelerate_interpolator"
   android:fillAfter="true"
   android:fillEnabled="true"&gt; 
&lt;/scale&gt;
</code></pre>

<p>In the adapter that returns the views for the Gallery, I set the background of each view to a state list drawable, so that a focus indicator will display around the view when focused:</p>

<pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:state_focused="true" android:drawable="@drawable/thumbnail_focus" /&gt;
    &lt;item android:drawable="@android:color/transparent" /&gt;
&lt;/selector&gt;
</code></pre>

<p>The animation and state list drawable appear to work fine, except for one issue.  When I focus off of the gallery onto another view, I would expect the focus background to be removed, and this is the case if I don't scale the item up using the animation.</p>

<p>However, after scaling the view, and focusing on another view, I experience the following.  The second image is the result of pressing the up arrow on a D-Pad, and focusing on the search button.</p>

<p>Any thoughts on what the issue might be?  </p>

<p>Note: If I set a listener on the button, and invalidate the gallery, then the focus is handled properly.  However, this seems like a hacky way to fix the issue.  I'm assuming I need to modify the view bounds or something.</p>

<p><img src="http://i.stack.imgur.com/z637V.png" alt="Focused">
<img src="http://i.stack.imgur.com/USiuG.png" alt="Not Focused"></p>

<p>I am using API level 13.</p>

<p>Thanks.</p>
