StackedHorizontalProgressBar

Android library with ability to show two progress indicators in one horizontal progress bar.

Including in your project

StackedHorizontalProgressBar is available in the Jcenter, so getting it as simple as adding it as a dependency

compile 'com.github.nisrulz:stackedhorizontalprogressbar:{latest version}'

where {latest version} corresponds to published version in Maven Central

Usage

  1. Put the StackedHorizontalProgressBar element in your layout

    
     <github.nisrulz.stackedhorizontalprogressbar.StackedHorizontalProgressBar
             android:id="@+id/stackedhorizontalprogressbar"
             style="?android:attr/progressBarStyleHorizontal"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_margin="5dp"
             android:progressDrawable="@drawable/stacked_horizontal_progress"/>
            
    
  2. Reference in code as below

    int primary_pts = 3;
    int secondary_pts = 6;
    int max = 10;
    
    StackedHorizontalProgressBar stackedHorizontalProgressBar;
    stackedHorizontalProgressBar = (StackedHorizontalProgressBar) findViewById(R.id.stackedhorizontalprogressbar);
    stackedHorizontalProgressBar.setMax(max);
    stackedHorizontalProgressBar.setProgress(primary_pts);
    stackedHorizontalProgressBar.setSecondaryProgress(secondary_pts);
    
    
  3. If you wish to edit the colors, just edit the colors.xml file under the res > values
    folder and add the below colors (modify the values as per your requirement)

    <!-- Stacked Horizontal Progressbar Colors -->
    <color name="shpbr_primary_progress">#3F51B5</color>
    <color name="shpbr_secondary_progress">#FF4081</color>
    

GitHub

https://github.com/nisrulz/stackedhorizontalprogressbar