Without using any outside APIs, how do I draw a simple green horizontal bar to depict a percentage? (Full being 100%)
One way I thought of was using a SeekBar but I’m not sure how to customize the height, colors, etc of it.
Is there a formula I could use to draw a rectangle on a canvas or something that would use the desired scale that I need?
For example, if I have a refrigerator that can fit 38 items, a full bar would render when there was 38 items present.
You should use ProgressBar See the documentation.
Sample code.
Note this
style="?android:attr/progressBarStyleHorizontal"It makes the Progress a horizontal bar instead of the spinner you were talking about. U can set the color and drawable by usingandroid:progressDrawable="@drawable/mydrawable"