Wednesday, June 15, 2011

[android-developers] Re: SeekBar bug? Calling setThumb(drawable) makes thumb disappear

Thanks for the hint, Romain! Here is the code that now works:

final int drawableId = R.drawable.thumb1;
final Drawable d = getResources().getDrawable(drawableId);
d.setBounds(new Rect(0, 0, d.getIntrinsicWidth(),
d.getIntrinsicHeight())); <== this is the new call
slider.setThumb(d);

Regards,
Blake


On Jun 15, 12:58 pm, Romain Guy <romain...@android.com> wrote:
> You probably need to call setBounds() on the drawable to give it a size?
>
>
>
>
>
>
>
>
>
> On Wed, Jun 15, 2011 at 6:03 AM, Blake B. <bbuckle...@yahoo.com> wrote:
> > I'm using a custom image for the Thumb on my SeekBar.  I want to
> > change the image at some points in my app, but whenever
> > setThumb(drawable) is called, the Thumb image disappears.  The seekbar
> > still works, but it's like the Thumb is invisible.
>
> > I've found a few other questions regarding this, but no answers, and
> > there is no Issue being tracked that I could find.  Does anyone know
> > what I'm doing wrong, or how to work around this?  Any Googlers that
> > are familiar with SeekBar?
>
> > Thanks,
> > Blake
>
> > --
> > 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+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment