0

I am using ProgressBar dynamically. Now, I want to set its width based on Its Progress.

For i.e. If Its progress is 10% then show its width 10%, If Its progress is 82% then show its width 82%.

Layout.xml:

<ProgressBar
        android:id="@+id/pbAccuracy"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="wrap_content"
        android:layout_height="20dp"
        android:layout_marginLeft="9dp"
        android:layout_toRightOf="@+id/tvTopic" />

I have RelativeLayout in xml file.

Jeeten Parmar
  • 5,568
  • 15
  • 62
  • 111
  • I assume that by `Set width of ProgressBar` you mean "set progress indicator"... ? – Phantômaxx Mar 14 '14 at 09:43
  • So, you just have to initialize the minum (say, 0), maximum (say, 100) once and set the value while processing (an AsyncTask is your best friend, here). – Phantômaxx Mar 14 '14 at 09:49

1 Answers1

0

Use solution described http://www.mkyong.com/android/android-progress-bar-example/

Where

 progressBar.setProgress(your start point);
 progressBar.setMax(progress end point); 

will do the trick for you.

Moyeen
  • 469
  • 2
  • 8
  • 17