如何禁用将标记拖到圆外

时间:2019-01-21 21:22:19

标签: android google-maps

我希望用户仅在Google地图的精度圆内拖动标记,我尝试使用LatLngBounds创建边界,但边界始终是矩形。我检查了很多示例,但没有找到解决方法。

LatLngBounds createBoundsWithMinDiagonal(@NonNull Location location) { LatLng center = new LatLng(location.getLatitude(), location.getLongitude()); double radius = location.getAccuracy(); return new LatLngBounds.Builder(). include(SphericalUtil.computeOffset(center, radius, 0)). include(SphericalUtil.computeOffset(center, radius, 90)). include(SphericalUtil.computeOffset(center, radius, 180)). include(SphericalUtil.computeOffset(center, radius, 270)).build(); }

0 个答案:

没有答案