Skip to content Skip to sidebar Skip to footer

How Can I Change The Android Seekbar Thumb Drawable After 'oncreate' Method?

Currently I am attempting to change the drawable image of the Thumb of a seekbar in android. In the onCreate() method I am able to effectively change the thumb using the following

Solution 1:

One thing that has partially worked for me is to use the setBounds method however the problem I have run into is that in my app it resets the position of the thumb drawable back to the beginning of the line. I don't know if this is related to how my code works or if it happens no matter how it is implemented.

Drawable myThumb = getResources().getDrawable(R.drawable.slider_button);
myThumb.setBounds(new Rect(0, 0, myThumb.getIntrinsicWidth(),myThumb.getIntrinsicHeight()));
skbr.setThumb(myThumb);

Post a Comment for "How Can I Change The Android Seekbar Thumb Drawable After 'oncreate' Method?"