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 6084599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:32:27+00:00 2026-05-23T11:32:27+00:00

I am appending progressbar in elements of a list and also dynamically updating that

  • 0

I am appending progressbar in elements of a list and also dynamically updating that progressbar.
But the odd situation that i m facing is that..

When i have more than one element in my list and i change the color of progressbar by using Progressbar.setProgressDrwable(), all progressbars in the list are updated and their color is changed as desired.

But when I have only one single element in the list this method doesn’t work, All I can see the background of my progressbar not the color.

I have also created my XML file for progressbar’s background and color but than also its not working.

My XMl code for ProgressDrawable is

FirstColor.xml

<item android:id="@android:id/background">
    <shape>
        <corners android:radius="15dip" />
        <gradient android:startColor="#A9A9A9" android:centerColor="#A9A9A9"
            android:endColor="#A9A9A9" android:angle="90" />
        <stroke android:width="5dp" android:color="#A9A9A9" />
    </shape>
</item>

<item android:id="@android:id/progress">
     <scale  android:scaleGravity="left" android:scaleWidth="100%" >
        <shape>
            <corners android:radius="15dip" />
            <gradient android:startColor="#ADFF2F" android:centerColor="#ADFF2F"
                android:endColor="#ADFF2F" android:angle="90" />
            <stroke android:width="5dp" android:color="#ADFF2F" />
        </shape>
    </scale>
</item>

SecondColor.xml

<item android:id="@android:id/background">
    <shape>
        <corners android:radius="15dip" />
        <gradient android:startColor="#A9A9A9" android:centerColor="#A9A9A9"
            android:endColor="#A9A9A9" android:angle="90" />
        <stroke android:width="5dp" android:color="#A9A9A9" />
    </shape>
</item>

<item android:id="@android:id/progress">
    <scale android:scaleGravity="left" android:scaleWidth="100%" >
        <shape>
            <corners android:radius="15dip" />
            <gradient android:startColor="#FFBF00" android:centerColor="#FFBF00"
                android:endColor="#FFBF00" android:angle="90" />
            <stroke android:width="5dp" android:color="#FFBF00" />
        </shape>
    </scale>
</item>

and the java code that i m using to change the color of progressbar is

progressbar1.setProgressDrawable(getResources().getDrawable(R.drawable.FirstColor));
progressbar1.setProgress(amntPercentage.intValue());

progressbar1.setProgressDrawable(getResources().getDrawable(R.drawable.SecondColor));
progressbar1.setProgress(amntPercentage.intValue());

If anyone out there can solve my problem it would be a great help..
Thanks in advance..

  • 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-23T11:32:28+00:00Added an answer on May 23, 2026 at 11:32 am

    Before setting the new progressDrawable and setting the progressvalue, make sure that you have not setted the progressvalue to ‘0’.
    This happens because in style.xml for progressbar we define the xml fields only for start, middle and end; not for ‘0’.

    I setted the progressvalue to ‘1’ before changing the drawable and my project is working fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say that I would like to construct a list (L2) by appending elements
I'm appending some items dynamically to an unordered list, but the jQuery .append() function
I am dynamically appending form elements. The newly appended elements need to have distinct
I have a file that keeps appending the following xml. What I want to
I have a situation where I'm appending a node inside an element and would
I am dynamically appending HTML to a webpage and I'm also using jQuery to
I have a js file that is appending html. For one specific relative link,
I have an object that is appending a local string to another, and then
I have a script that is appending new fields to an existing CSV, however
I am appending new data - $('#posts').append(data); But I want this new data to

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.