2つのマーカーを囲むGoogleマップに色合いを適用したいとします。これまでのところ私が得た唯一の作業溶液は、実際にGoogleMapsで色を追加
createRectangle()
はしかし作成
https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/PolygonDemoActivity.java
private List<LatLng> createRectangle(LatLng center, double halfWidth, double halfHeight) {
return Arrays.asList(new LatLng(center.latitude - halfHeight, center.longitude - halfWidth),
new LatLng(center.latitude - halfHeight, center.longitude + halfWidth),
new LatLng(center.latitude + halfHeight, center.longitude + halfWidth),
new LatLng(center.latitude + halfHeight, center.longitude - halfWidth),
new LatLng(center.latitude - halfHeight, center.longitude - halfWidth));
}
からオーバーレイが全体マッププレビュー をカバーしていない方法である
map.addPolygon(new PolygonOptions()
.addAll(createRectangle(SphericalUtil.interpolate(markerData.getStartPoint(), markerData.getEndPoint(), CENTER_POINT_INTERPOLATE), 90, 45))
.strokeColor(Color.TRANSPARENT)
.fillColor(resources.getColor(R.color.tint_black_40)));
として地図上にポリゴンを描画することです。誰もが既存のアプローチを改善するために私を助けることができるか、これに対処するより良い方法を提案するか?
したがって、半透明の色でフルマップをカバーする必要がありますか? – antonio