本文整理汇总了Java中com.google.maps.android.clustering.view.DefaultClusterRenderer类的典型用法代码示例。如果您正苦于以下问题:Java DefaultClusterRenderer类的具体用法?Java DefaultClusterRenderer怎么用?Java DefaultClusterRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultClusterRenderer类属于com.google.maps.android.clustering.view包,在下文中一共展示了DefaultClusterRenderer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupClusterManager
import com.google.maps.android.clustering.view.DefaultClusterRenderer; //导入依赖的package包/类
private void setupClusterManager() {
// reference
// clustering
if(mMap!=null) {
mClusterManager = new ClusterManager<>(getActivity(), mMap);
mClusterManager.setRenderer(new DefaultClusterRenderer<Hotel>(getActivity(), mMap, mClusterManager) {
@Override
protected void onBeforeClusterItemRendered(Hotel item, MarkerOptions markerOptions) {
int size = getActivity().getResources().getDimensionPixelSize(R.dimen.fragment_map_marker_size);
Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.markerfield);
Bitmap bitmap = BitmapScaler.scaleToFill(originalBitmap, size, size);
if(originalBitmap!=bitmap){
originalBitmap.recycle();
}
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
markerOptions.title(item.getName());
markerOptions.icon(bitmapDescriptor);
markerOptions.snippet(""+item.getPrice());
super.onBeforeClusterItemRendered(item, markerOptions);
}
});
mClusterManager.setOnClusterItemInfoWindowClickListener(new ClusterManager.OnClusterItemInfoWindowClickListener<Hotel>() {
@Override
public void onClusterItemInfoWindowClick(Hotel i)
{
getActivity().finish();
// Toast.makeText(getActivity(), "Action", Toast.LENGTH_SHORT).show();
}
});
// mMap.setOnCameraMoveCanceledListener(m);
//setOnCameraChangeListener(mClusterManager);
mMap.setOnInfoWindowClickListener(mClusterManager);
renderView();
}
}
示例2: ClusterManager
import com.google.maps.android.clustering.view.DefaultClusterRenderer; //导入依赖的package包/类
public ClusterManager(Context context, GoogleMap map, MarkerManager markerManager) {
mMap = map;
mMarkerManager = markerManager;
mClusterMarkers = markerManager.newCollection();
mMarkers = markerManager.newCollection();
mRenderer = new DefaultClusterRenderer<T>(context, map, this);
mAlgorithm = new PreCachingAlgorithmDecorator<T>(new NonHierarchicalDistanceBasedAlgorithm<T>());
mClusterTask = new ClusterTask();
mRenderer.onAdd();
}