我想在地图内的叠加层中勾勒出文本。我尝试了下面的代码,但结果不是很令人满意。
Paint paint = new Paint();
paint.setTextAlign(Paint.Align.CENTER);
paint.setTextSize(mTextSize);
paint.setAntiAlias(true);
// paint.setARGB(150, 0, 0, 0); // alpha, r, g, b (Black, semi see-through)
// paint.setARGB(255, 255, 255, 255);
paint.setColor(0xFFFFFFFF );
//paint.setStyle(Paint.Style.STROKE);
paint.setStyle(/*Paint.Style.FILL_AND_STROKE*/Paint.Style.FILL);
//show text to the right of the icon
canvas.drawText(item.getTitle(), ptScreenCoord.x+(distancesShift), ptScreenCoord.y+23-mTextSize, paint);
// again to show outline
Paint paint2 = new Paint();
paint2.setTextAlign(Paint.Align.CENTER);
paint2.setTextSize(mTextSize);
paint2.setAntiAlias(true);
paint2.setTextAlign(Paint.Align.CENTER);
// paint.setARGB(150, 0, 0, 0); // alpha, r, g, b (Black, semi see-through)
// paint2.setARGB(255, 255, 255, 255);
paint2.setColor(0x00000000);
paint2.setStyle(Paint.Style.STROKE);
paint2.setStrokeWidth(4);
canvas.drawText(item.getTitle(), ptScreenCoord.x+(distancesShift), ptScreenCoord.y+23-mTextSize, paint2);