使用以下代码绘制圆圈(取自Google Play服务"地图"示例):
PolylineOptions options = new PolylineOptions();
int radius = 5; //What is that?
int numPoints = 100;
double phase = 2 * Math.PI / numPoints;
for (int i = 0; i <= numPoints; i++) {
options.add(new LatLng(SYDNEY.latitude + radius * Math.sin(i * phase),
SYDNEY.longitude + radius * Math.cos(i * phase)));
}
int color = Color.RED;
mMap.addPolyline(options
.color(color)
.width(2));
Run Code Online (Sandbox Code Playgroud)
这是在世界不同地区得出的:

如你所见圆圈不是真正的圆圈,甚至第二个圆圈基本上都是椭圆形.
我想圈子的"抗锯齿"取决于int numPoints变量中的点数.
int radius = 5示例代码中的变量是什么?我是说它的衡量标准是什么?canvas.drawCircle()更新--------------------
改进数学后我可以画出"正确"的圆圈:
private void addCircle(LatLng …Run Code Online (Sandbox Code Playgroud) 我知道如何制作圆角矩形,像这样
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#FF0000"/>
<corners
android:radius="10000dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)
它看起来像这样:
但我想让它的反面(中心透明,侧面填充颜色),它应该是这样的:
谢谢