2

I'm trying to create custom SeekBar.I want to add textview or text on seekbar's thumb and change this textview dynamically. How can i do this ?

My design is here https://i.stack.imgur.com/k1ifi.png

1 Answers1

0

I've used this function for a solution;

public BitmapDrawable writeOnDrawable(Bitmap thumb, String text) {

Bitmap bm = thumb.copy(Bitmap.Config.ARGB_8888, true);

Paint paint = new Paint();
paint.setStyle(Style.FILL);
paint.setColor(Color.parseColor("#288ca0"));
paint.setTextSize(bm.getHeight() / 3);
paint.setTypeface(type);
Canvas canvas = new Canvas(bm);
canvas.drawText(text , bm.getWidth() / 4 - bm.getWidth()/10,
        bm.getHeight() / 2 + bm.getHeight() / 10, paint);

return new BitmapDrawable(bm);
}