Google map clustering in android
<p>I want to change  clustering icon like below in android. In a circle there will be a one imageview and one textview.</p>

<p><a href="https://i.stack.imgur.com/1EGFn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1EGFn.jpg" alt="enter image description here"></a></p>

<p>My code for custom icon</p>

<pre><code>  private class ItemRenderer extends DefaultClusterRenderer&lt;ClusterPopupList&gt; {
    private final IconGenerator mIconGenerator = new IconGenerator(getApplicationContext());
    private final IconGenerator mClusterIconGenerator = new IconGenerator(getApplicationContext());
    private final int mDimension;

    public ItemRenderer() {
        super(getApplicationContext(), map, mClusterManager);

        View multiProfile = getLayoutInflater().inflate(R.layout.multi_profile,null);
        mClusterIconGenerator.setContentView(multiProfile);
        mImageView = new ImageView(getApplicationContext());
        mDimension = (int) getResources().getDimension(R.dimen.custom_profile_image);
        mImageView.setLayoutParams(new ViewGroup.LayoutParams(mDimension, mDimension));
        mIconGenerator.setContentView(mImageView);
    }

    @Override
    protected void onBeforeClusterItemRendered(ClusterPopupList item, MarkerOptions markerOptions) {
        mImageView.setImageResource(item.profilePhoto);
        Bitmap icon = mIconGenerator.makeIcon();
        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
        super.onBeforeClusterItemRendered(item, markerOptions);

    }

    @Override
    protected void onBeforeClusterRendered(Cluster&lt;ClusterPopupList&gt; cluster, MarkerOptions markerOptions) {
        List&lt;Drawable&gt; profilePhotos = new ArrayList&lt;Drawable&gt;(Math.min(4, cluster.getSize()));
        int width = mDimension;
        int height = mDimension;

        for (ClusterPopupList p : cluster.getItems()) {
            // Draw 4 at most.
            if (profilePhotos.size() == 4) break;
            Drawable drawable = getResources().getDrawable(p.profilePhoto);
            drawable.setBounds(0, 0, width, height);
            profilePhotos.add(drawable);
        }

        Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
    }

    @Override
    protected void onClusterRendered(Cluster&lt;ClusterPopupList&gt; cluster, Marker marker) {
        super.onClusterRendered(cluster, marker);
    }

    @Override
    public ClusterPopupList getClusterItem(Marker marker) {

        return super.getClusterItem(marker);
    }

    @Override
    protected boolean shouldRenderAsCluster(Cluster&lt;ClusterPopupList&gt; cluster) {
        return cluster.getSize() &gt; 1;
    }
}
</code></pre>

<p>multi_profile.xml</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
&gt;
&lt;de.hdodenhof.circleimageview.CircleImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:background="@android:color/transparent"
    android:src="@drawable/icon_cluster_count"/&gt;

&lt;TextView
    android:id="@id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="@style/Bubble.TextAppearance.Light"
    android:paddingLeft="@dimen/custom_profile_padding"
    android:paddingRight="@dimen/custom_profile_padding"
    android:layout_below="@id/image"
    android:text="150"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="8dip"
    android:textColor="@color/theme_color"
    android:alpha=".8"/&gt;
   &lt;/RelativeLayout&gt;
</code></pre>

<p>Output :</p>

<p><a href="https://i.stack.imgur.com/sJ06Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sJ06Y.png" alt="enter image description here"></a></p>

<p>I want to achieve cluster icon like first image in a circle. I have used circle background in relative layout, but that does not work.</p>