AnimationDrawable can be used to implement simple thumb animation such
as blinking.

* Create animation in anim/thumb_anim.xml:

<animation-list
        xmlns:android="http://schemas.android.com/apk/res/android";
        android:oneshot="true">

  <item android:drawable="@drawable/red" android:duration="300" />
  <item android:drawable="@drawable/blue" android:duration="300" />
   ...
  <item android:drawable="@drawable/ball_red" android:duration="300" /
>
</animation-list>

* Create an ImageView that turns the above XML into AnimationDrawable:
   //mImageView.setVisibility(View.INVISIBLE);
   mImage.setBackgroundResource(R.anim.thumb_anim);
   mAnim = (AnimationDrawable)mImage.getBackground();

* Set seekbar thumb to the AnimationDrawable:

   mSeekBar.setThumb(mAnim);


* In onWindowFocuseChanged,

  public void onWindowFocusChanged(boolean hasFocus) {
        if(hasFocus) {
           mAnim.start();
        } else {
            mAnim.stop();
        }
  }

  This step is baesd on disucssion in:  
http://code.google.com/p/android/issues/detail?id=79#c4

* Note the imageview is needed only for turning the XML into
AnmiationDrawable so
  its visibility can be turned off (or using a ViewStub ?)

* Also need to turn off mAnim as soon as user starts interacting w/
the thumb.



As pointed out in
On Jun 20, 12:11 pm, Protocol-X <shawn.bur...@gmail.com> wrote:
> I appear to be having the same issue
>
> On Jun 19, 6:42 pm, az9702 <az9...@gmail.com> wrote:
>
> > Hi,
>
> > As the seekbarthumbis a drawable so its support for animation seems
> > limited.
> > It may not be feasible but I would like to hear feedback from those
> > who have more experience w/ UI.
>
> > Animations I have in mind are quite simple like a few blinks when
> > layout becomes visible.
> > With Views, blinks can be easily implemented with alpha & cycles but
> > not so for Drawables.
>
> > I explored several ideas but none seems to work well:
>
> > * Using AnimationDrawable does not seem to help as it requires an
> > ImageView host.
>
> > * My main activity has an animation on its layout.
> >   I tried tosetthethumbdrawable to another bitmap onAnimationEnd
> > when the main layout is complete.
> >    The old drawable went away but the new one did not show so 
> > thethumbdisappeared.
> >    I checked the thumboffset to make sure it was not out of range.
>
> > *Seta Drawable callback on the drawable but that also requires a
> > view.
>
> > Another way is to have a custom seekbar with a View forthumbinstead
> > of Drawable.
>
> > Please let me know if I have overlooked any other options currently
> > supported by SDK ?
>
> > Thanks in advance.
>
> > - az9702
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to