我正在尝试在 Android 上的 MapView 上绘制一些文本。文本的绘制很好,但是很难阅读文本,因为它是白色的,没有黑色边框(就像在 MapViews 上自然出现的用于表示城市、州和国家的文本的其余部分)。我似乎无法弄清楚如何用黑色边框绘制文本。有人知道怎么做吗?
这是我现在正在使用的那种代码(这只是示例代码,在我的一个叠加层中找到):
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(16);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, textPaint);
super.draw(canvas, mapView, shadow);
}