【发布时间】:2014-02-20 12:06:30
【问题描述】:
如何将我的 android 应用 Google 地图半径圆圈替换为蓝色半透明圆圈,如图片中的蓝色标记和蓝色圆圈?
我可以使圆圈具有特定的轮廓和填充,但它看起来并不像下图所示的那样漂亮。我怎么做?到目前为止,我的代码也在下面。
代码:
private GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
initilizeMap();
} catch (Exception e) {
e.printStackTrace();
}
}
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
LatLng latLng = new LatLng(28.982518, -81.542272);
gooleMap.addMarker(new MarkerOptions().position(latLng));
Circle circle = gooleMap.addCircle(new CircleOptions()
.center(new LatLng(28.982518, -81.542272))
.radius(1000)
.strokeColor(Color.RED)
.fillColor(Color.PURPLE));
mMap.addCircle(new CircleOptions()
.center(center)
.radius(radius)
.strokeWidth(0f)
.fillColor(0x550000FF));
}
}
@Override
protected void onResume() {
super.onResume();
initilizeMap();
}
}
Android xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
图片:
为了确认,我想要做的是:
显示上图效果,如上图所示,一个深蓝色的圆圈加上半透明的浅蓝色填充
【问题讨论】:
-
您在找
GoogleMap.setMyLocationEnabled(true)电话吗? -
不抱歉,我正在尝试创建上述效果。带有半透明蓝色的圆形半径
-
你是什么意思,它看起来一点也不好看……它是什么样子的
标签: java android eclipse google-maps