Пример #1
0
 @Override
 protected void onBeforeClusterItemRendered(MarkerData item, MarkerOptions markerOptions) {
   super.onBeforeClusterItemRendered(item, markerOptions);
   imageView.setImageResource(item.getProfilePhoto());
   Bitmap icon = iconGenerator.makeIcon();
   markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(item.getName());
 }
Пример #2
0
    @Override
    protected void onBeforeClusterRendered(
        Cluster<MarkerData> cluster, MarkerOptions markerOptions) {
      super.onBeforeClusterRendered(cluster, markerOptions);
      List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));
      int width = dimension;
      int height = dimension;

      for (MarkerData markerData : cluster.getItems()) {
        // Draw 4 at most.
        if (profilePhotos.size() == 4) break;
        Drawable drawable =
            ContextCompat.getDrawable(getApplicationContext(), markerData.getProfilePhoto());
        //                        getResources().getDrawable(markerData.getProfilePhoto());
        drawable.setBounds(0, 0, width, height);
        profilePhotos.add(drawable);
      }
      MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
      multiDrawable.setBounds(0, 0, width, height);

      clusterImageView.setImageDrawable(multiDrawable);
      Bitmap icon = clusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
      markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
    }