【发布时间】:2017-10-02 07:35:24
【问题描述】:
我正在尝试在谷歌地图中添加连接一组点的折线。当我构建应用程序时,我没有收到任何错误但折线没有出现。如果我调用 isvisible() 方法它返回 true。请帮助
@Override
public void onMapReady(GoogleMap googleMap) {
// new LongOperation().execute("");
/* googleMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this, R.raw.mapjson));*/
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
googleMap.setMyLocationEnabled(true);
googleMapnew = googleMap;
Polyline polyline1 = googleMap.addPolyline(new PolylineOptions()
.clickable(true)
.add(
new LatLng(13.034063, 77.567006 ),
new LatLng(13.034087, 77.568629),
new LatLng(13.034202, 77.569431),
new LatLng(13.034371, 77.570103),
new LatLng(13.034535, 77.570121),
new LatLng(13.036526, 77.570489),
new LatLng(13.037719, 77.570545),
new LatLng(13.038252, 77.570039),
new LatLng(13.039849, 77.570028),
new LatLng(13.040153, 77.569229),
new LatLng(13.040640, 77.568512),
new LatLng(13.041071, 77.567996),
new LatLng(13.041780, 77.567894))
.color(Color.GREEN)
.width(66));
Log.e("polylog", String.valueOf(polyline1.isVisible()));
Log.e("polylog", String.valueOf(polyline1));
}
【问题讨论】:
标签: android google-maps google-polyline