Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7068181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:17:33+00:00 2026-05-28T05:17:33+00:00

I have a seek bar and I am setting the thumb drawable in code.

  • 0

I have a seek bar and I am setting the thumb drawable in code. When the activity is starting I can see the changed drawable for the thumb but if I start a new activity from the seekbar activity and come back, the seekbar’s thumb gets invisible (only if I set it’s drawable again). This is happening only if I come back from other activity to the seekbar activity.

I need to change the drawable of the thumb in onRestart() because the other activityes may change the color or shape of the thumb and I need to refresh it’s drawable.

I tried invalidate() on the seekbar but no use…

EDIT:
I tried to make 3 static Drawable objects and load the images in onCreate() and I noticed that after coming back on the SeekBar activity, if I set the thumb drawable to the one that is already set, the thumb is visible but if I change the drawable, the thumb becomes invisible.

EDIT 2:

In this case I set the loaded drawables to the thumb:

String gender = getGender();
    if (gender.equals(Profile.GENDER_1)) {
        mSeekBar.setThumb(mDrawable1);
    } else if (gender.equals(Profile.GENDER_2)) {
        mSeekBar.setThumb(mDrawable2);
    } else {
        mSeekBar.setThumb(mDrawable3);
    }

And this is if I try to get the drawables from the resources

String gender = getGender();

if (gender.equals(Profile.GENDER_1)) {
    mDrawable = mSeekBar.getContext().getResources().getDrawable(R.drawable.slider_thumb_1);
} else if (gender.equals(Profile.GENDER_2)) {
    mDrawable = mSeekBar.getContext().getResources().getDrawable(R.drawable.slider_thumb_2);
} else {
    mDrawable = mSeekBar.getContext().getResources().getDrawable(R.drawable.slider_thumb_3);
}

mSeekBar.setThumb(mDrawable);

In both cases the thumb is getting invisible..

What can be the problem? does somebody know the answer?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:17:34+00:00Added an answer on May 28, 2026 at 5:17 am

    You are not setting the drawable’s bounds before using it.

    Try adding this line before the setThumb() call:

    mDrawable.setBounds(0,0, 
        mDrawable.getIntrinsicWidth(), 
        mDrawable.getIntrinsicHeight()
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set thumb image of a seek bar but my thumb looks little
I have the following event handler for my html element jQuery(#seek-bar).click(function(e){ var x =
I have followed this tutorial to create a seek bar on a transparent background.
I know that Service can have a reference to Activity . Does the opposite
I only know Wordpress and have started to seek another alternative framework, Zend. I
I am using MFC CFile Seek function. I have a problem about Seek out
I have problem with this code: file = tempfile.TemporaryFile(mode='wrb') file.write(base64.b64decode(data)) file.flush() os.fsync(file) # file.seek(0)
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I have created a flash movie in AS3, I wanted to have a seek

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.