我正在尝试创建自定义SeekBar。我想在搜索栏的拇指上添加textview或文本,并动态更改此textview。我怎么能这样做?
答案 0 :(得分:0)
我已将此功能用于解决方案;
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);
}