是否在屏幕上显示位置 - 在Android上的谷歌地图

hal*_*aya 3 android google-maps

我有一个纬度和经度的位置.我想检查用户更改相机位置或缩放时是否在屏幕上显示这些位置.如果屏幕包含此位置,我想成为现实,否则为假.有可能确定吗?

Sim*_*ant 8

执行此操作的最佳方法是检查标记是否在地图可见区域的范围内.

Marker myPosition;//get your marker
LatLngBounds bounds = googleMap.getProjection().getVisibleRegion().latLngBounds;
if(bounds.contains(myPosition.getPosition())){
  //point is visible
}else{
  //not visible
}
Run Code Online (Sandbox Code Playgroud)