How do I make a bar in Android that has multiple sections? I’ve tried a ProgressBar, but I cannot get it to work and neither does it sound a correct application of ProgressBar. In HTML I’d just use something like:
<style>
#bar { width: 100px; }
.bar { height: 20px; }
.black { background-color: black; }
</style>
<div id="bar">
<div class="bar" style="width: 15px;"></div>
<div class="bar black" style="width: 25%;"></div>
<div class="bar" style="width: 5%;"></div>
<div class="bar black" style="width: 40%;"></div>
<div class="bar" style="width: 15%;"></div>
</div>
What the efficient equivalent in Android?

Use a horizontal
LinearLayout.You can then create the views inside it and decide their relative size with the
layout_weightattribute.Here is an example that gives your desired result:
Note that the weights are floats. I just put whole numbers and a sum of 100 to correspond to your percent-based layout.