我尝试将文本添加drawable
到layerdrawable
. 我尝试了以下代码:
Bitmap canvasBitmap = Bitmap.createBitmap(sb.getWidth(), sb.getHeight(), Bitmap.Config.ARGB_8888);
Canvas imageCanvas = new Canvas(canvasBitmap);
imageCanvas.drawARGB(0, 0, 0, 0);
Paint p = new Paint();
p.setColor(Color.WHITE);
p.setTextSize(40);
imageCanvas.drawText("Sample text display here", 0, sb.getHeight()/2, p);
LayerDrawable background = new LayerDrawable(new Drawable[]{new BitmapDrawable(canvasBitmap)});
但是与其他文本字段相比,质量很差。
我需要关于如何提高文本质量或以其他方式将文本添加到drawable
.