我想知道如何在android中的文本上添加阴影?
我有以下代码应用于位图,我想被阴影...
paint.setColor(Color.BLACK);
paint.setTextSize(55);
paint.setFakeBoldText(false);
paint.setShadowLayer(1, 0, 0, Color.BLACK); //This only shadows my whole view...
Run Code Online (Sandbox Code Playgroud) 我正在尝试在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);
}
Run Code Online (Sandbox Code Playgroud)