title: android UI: ImageButton with animation
body: <p>I'm looking to make an ImageButton that contains an animation drawable, more precisely the repetitive tweened animation of a progressbar spinner (like the view/widget that exists for this).</p>
  
  <p>In xml I specified this for the ImageButton in the activity's layout:</p>
  
  <pre><code>&lt;ImageButton android:id="@+id/i_back_cover" android:layout_width="wrap_content" 
      android:layout_height="wrap_content" android:scaleType="centerInside" 
      android:gravity="center" android:layout_weight="1" android:adjustViewBounds="true" 
      android:src="@anim/progress_large"&gt; 
  &lt;/ImageButton&gt;
  </code></pre>
  
  <p>The "progress_large" animation is in res/anim/:</p>
  
  <pre><code>&lt;set xmlns:android="http://schemas.android.com/apk/res/android"
      android:interpolator="@android:anim/linear_interpolator"&gt;
      &lt;rotate
          android:drawable="@drawable/spinner_black_76"
          android:pivotX="50%"
          android:pivotY="50%"
          android:fromDegrees="0"
          android:toDegrees="350"
          android:duration="1200" /&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p>I set <code>toDegrees</code> to 350 for now, to make sure it would rotate. <code>spinner_black_76</code> is just an image.</p>
  
  <p>When I open the activity having this layout, the app crashes before displaying. </p>
  
  <p>Weird, there's no actual stacktrace in the log, just a killed VM if I'm right (I hardly can believe this myself):</p>
  
  <pre><code>10-07 21:16:18.467: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.EDIT dat=content://net.lp.collectionista.products/items/book/1 cmp=net.lp.collectionista/.ui.activities.items.book.BookItemEditWindow }
  10-07 21:16:18.687: DEBUG/AndroidRuntime(636): Shutting down VM
  10-07 21:16:18.687: WARN/dalvikvm(636): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
  10-07 21:16:18.687: DEBUG/FlurryAgent(636): Ending session
  10-07 21:16:18.977: DEBUG/dalvikvm(636): GC_FOR_MALLOC freed 3876 objects / 597200 bytes in 98ms
  10-07 21:16:19.007: WARN/ActivityManager(59):   Force finishing activity net.lp.collectionista/.ui.activities.items.book.BookItemEditWindow
  10-07 21:16:19.016: WARN/ActivityManager(59):   Force finishing activity net.lp.collectionista/.ui.activities.collections.book.BookCollectionViewWindow
  10-07 21:16:19.507: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{43fec528 net.lp.collectionista/.ui.activities.items.book.BookItemEditWindow}
  10-07 21:16:21.437: INFO/Process(636): Sending signal. PID: 636 SIG: 9
  10-07 21:16:21.487: INFO/ActivityManager(59): Process net.lp.collectionista (pid 636) has died.
  10-07 21:16:21.517: INFO/WindowManager(59): WIN DEATH: Window{4400f330 net.lp.collectionista/net.lp.collectionista.ui.activities.CollectionsListWindow paused=false}
  10-07 21:16:21.517: INFO/WindowManager(59): WIN DEATH: Window{43fc89d0 net.lp.collectionista/net.lp.collectionista.ui.activities.collections.book.BookCollectionViewWindow paused=true}
  10-07 21:16:21.667: INFO/UsageStats(59): Unexpected resume of com.android.launcher while already resumed in net.lp.collectionista
  10-07 21:16:21.727: WARN/InputManagerService(59): Got RemoteException sending setActive(false) notification to pid 636 uid 10034
  10-07 21:16:27.237: DEBUG/dalvikvm(278): GC_EXPLICIT freed 32 objects / 1616 bytes in 81ms
  10-07 21:18:14.047: DEBUG/AndroidRuntime(654): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  </code></pre>
  
  <p>What am I doing wrong in this case? Or what would be a better way to get a progressbar round spinner on top of a button?</p>