我正在尝试创建自定义 SeekBar。我想在 seekbar 的拇指上添加 textview 或文本并动态更改此 textview。我怎样才能做到这一点 ?
问问题
2259 次
1 回答
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);
}
于 2014-10-15T11:28:37.797 回答