本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.setOnMapLongClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleMap.setOnMapLongClickListener方法的具体用法?Java GoogleMap.setOnMapLongClickListener怎么用?Java GoogleMap.setOnMapLongClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.GoogleMap
的用法示例。
在下文中一共展示了GoogleMap.setOnMapLongClickListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public void onMapReady(GoogleMap googleMap) {
if (m_gMap == null) {
m_gMap = googleMap;
GoogleMap map = getMap();
if (map == null) {
MFBUtil.Alert(this, getString(R.string.txtError), getString(R.string.errNoGoogleMaps));
finish();
return;
}
map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
UiSettings settings = map.getUiSettings();
settings.setCompassEnabled(false);
settings.setRotateGesturesEnabled(false);
settings.setScrollGesturesEnabled(true);
settings.setZoomControlsEnabled(false);
settings.setZoomGesturesEnabled(true);
View mapView = getFragmentManager().findFragmentById(R.id.mfbMap).getView();
if (mapView != null && mapView.getViewTreeObserver() != null && mapView.getViewTreeObserver().isAlive()) {
mapView.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
map.setOnMarkerClickListener(this);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
map.setMyLocationEnabled(true);
}
map.setOnMapLongClickListener(this);
updateMapElements();
}
}
示例2: MapsManager
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
MapsManager(Activity context, GoogleMap map) {
mContext = context;
// 地圖
mMaps.add(MAP_CODE_MAIN, map);
mMapTiles.add(MAP_CODE_MAIN, null);
mZoomNumber = (TextView) context.findViewById(R.id.zoom_number);
// 顯示準心座標
mCrossCoor = (TextView) context.findViewById(R.id.tvCoord);
mCrossCoor.setOnClickListener((MapsActivity) mContext);
// 加入比例尺
RelativeLayout container = (RelativeLayout) context.findViewById(R.id.layout_container);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(800, 800);
mScaleBar = new ScaleBar(mContext, getMap(MAP_CODE_MAIN));
mScaleBar.setLayoutParams(params);
container.addView(mScaleBar);
// 註冊畫面縮放的監聽
map.setOnCameraMoveListener(this);
// Set the Listener
map.setOnMapClickListener(this);
map.setOnMapLongClickListener(this);
map.setOnInfoWindowClickListener(this);
map.setOnMarkerDragListener(this);
map.setOnCameraIdleListener(this);
// 在Activity和Map物件註冊ClusterManager
mClusterManagers.add(MAP_CODE_MAIN, new ClusterManager<CustomMarker>(mContext, map));
// The Rule about Cluster Managing
mClusterManagers.get(MAP_CODE_MAIN).setRenderer(
new CustomRenderer(mContext, map, mClusterManagers.get(MAP_CODE_MAIN)));
mClusterManagers.get(MAP_CODE_MAIN).setOnClusterClickListener(
(CustomRenderer) mClusterManagers.get(MAP_CODE_MAIN).getRenderer());
// Click on marker to open infoWindow
map.setOnMarkerClickListener(mClusterManagers.get(MAP_CODE_MAIN));
// POI in Google map
map.setOnPoiClickListener(this);
// Test for new info window
map.setInfoWindowAdapter(new CustomAdapter(mContext));
}