2 java eclipse android google-maps
如何更换我的Android应用程序谷歌地图半径圆与蓝色半透明的一个如图像也蓝色标记与蓝色圆圈?
我可以让圆圈有一个特定的轮廓和填充,但它看起来不像下图所示的那样好.我怎么做?到目前为止,我的代码也在下面.
码:
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();
}
}
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
图片:
要确认,我要做的是:
显示上述效果,如上图所示,带有半透明浅蓝色填充的深蓝色圆圈
j3g*_*j3g 10
CircleOptions circleOptions = new CircleOptions()
.center(latlng)
.radius(500)
.strokeWidth(2)
.strokeColor(Color.BLUE)
.fillColor(Color.parseColor("#500084d3"));
// Supported formats are: #RRGGBB #AARRGGBB
// #AA is the alpha, or amount of transparency
mMap.addCircle(circleOptions);
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
6349 次 |
| 最近记录: |