本文介绍了如何用图像中的蓝色半透明代替我的Android应用谷歌地图半径圈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何替换我的Android应用程序谷歌地图半径圆与蓝色半透明的一个如图像蓝色标记与蓝色圆圈

How do I replace my android app Google maps radius circle with a blue translucent one as in image also blue marker with blue circle?

我可以使圈子有一个特定的轮廓和填充,但它看起来不像任何接近像下面的图像所描绘的。我怎么做?我的代码到目前为止还在。

I can make the circle have a particular outline and fill but it doesn't look anywhere near as nice as the one depicted in the image below. How do I do that? my code so far is below also.

代码:

    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:

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>

图片:

要确认,我想要做的是:

To confirm, what I'm trying to do is:

显示上述效果,一个深蓝色的圆圈,半透明的浅蓝色填写上面的图片

推荐答案

    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);

这篇关于如何用图像中的蓝色半透明代替我的Android应用谷歌地图半径圈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 17:30