PinConfig

  • PinConfig is used to customize the appearance of AdvancedMarker icons in the Maps SDK for Android.

  • It allows developers to set background color, border color, and a central glyph for the marker icon.

  • PinConfig is not applicable to the Navigation SDK but is provided for compatibility with the Maps SDK.

  • A builder pattern is used to create PinConfig instances, making it easy to configure the desired icon style.

  • Default values for colors and dimensions are provided if not explicitly set by the developer.

public class PinConfig extends AbstractSafeParcelable

A class to configure the elements of an AdvancedMarker icon.

This class does not apply to the Navigation SDK. It exists for compile time compatibility with com.google.android.gms:play-services-maps only.

PinConfig pinConfig = PinConfig.builder()
     .setBackgroundColor(Color.RED)
     .setBorderColor(Color.GREEN)
     .setGlyph(Glyph("A"))
     .build()
 AdvancedMarkerOptions advancedMarkerOptions =
     new AdvancedMarkerOptions()
         .icon(BitmapDescriptorFactory.fromPinConfig(pinConfig))
         .position(new LatLng(48, -122))
         .title("A marker with customized background, border, and glyph.");
 map.addMarker(advancedMarkerOptions);
 

Nested Class Summary

class PinConfig.Builder A builder for creating PinConfig instances. 
class PinConfig.Glyph Defines a glyph, which is the element at the center of an AdvancedMarker icon. 

Constant Summary

int BITMAP_LENGTH_DP
int BITMAP_WIDTH_DP
int DEFAULT_PIN_BACKGROUND_COLOR
int DEFAULT_PIN_BORDER_COLOR
int DEFAULT_PIN_GLYPH_COLOR

Inherited Constant Summary

Public Method Summary

static PinConfig.Builder
builder()
Creates a builder for PinConfig.
int
getBackgroundColor()
Gets the background color for this PinConfig object.
int
getBorderColor()
Gets the border color for this PinConfig object.
PinConfig.Glyph
getGlyph()
Gets the PinConfig.Glyph object for this PinConfig object.
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

Constants

public static final int BITMAP_LENGTH_DP

Constant Value: 37

public static final int BITMAP_WIDTH_DP

Constant Value: 26

public static final int DEFAULT_PIN_BACKGROUND_COLOR

Constant Value: -1424587

public static final int DEFAULT_PIN_BORDER_COLOR

Constant Value: -3857889

public static final int DEFAULT_PIN_GLYPH_COLOR

Constant Value: -5041134

Public Methods

public static PinConfig.Builder builder ()

Creates a builder for PinConfig.

public int getBackgroundColor ()

Gets the background color for this PinConfig object.

Returns
  • background color.

public int getBorderColor ()

Gets the border color for this PinConfig object.

Returns
  • border color.

public PinConfig.Glyph getGlyph ()

Gets the PinConfig.Glyph object for this PinConfig object.

Returns
  • glyph.

public void writeToParcel (Parcel out, int flags)

Parameters
out
flags