Did this by extending the SeekBar widget. Two steps: first, create a new class called CustomSeekBar to extend the SeekBar:
package com.example.seekbar;
class CustomSeekBar extends SeekBar {
public CustomSeekBar(Context context) {
super(context);
}
public CustomSeekBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomSeekBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
private Paint paintRect = new Paint();
paintRect.setColor(Color.rgb(142, 196, 0));
private Rect audioRect = new Rect();
audioRect.set(5, 7, 4, 18);
canvas.drawRect(audioRect, paintRect);
}
}
Second, reference this CustomSeekBar in the layout xml file as:
<view class="com.example.seekbar.CustomSeekBar"
android:id="@+id/seekBar0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" />