PlaceMarker.Builder
public final class PlaceMarker.Builder
A builder of PlaceMarker.
Summary
Public methods |
|
|---|---|
@NonNull PlaceMarker |
build()Constructs the |
@NonNull PlaceMarker.Builder |
Sets the color that should be used for the marker on the map. |
@NonNull PlaceMarker.Builder |
Sets the icon to display in the marker. |
@NonNull PlaceMarker.Builder |
setLabel(@NonNull CharSequence label)Sets the text that should be displayed as the marker's content. |
Public methods
build
public @NonNull PlaceMarker build()
Constructs the PlaceMarker defined by this builder.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the icon is of the type |
setColor
public @NonNull PlaceMarker.Builder setColor(@NonNull CarColor color)
Sets the color that should be used for the marker on the map.
This color is applied in the following cases:
- When the
PlaceMarkeris displayed on the map, the pin enclosing the icon or label will be painted using the given color. - When the
PlaceMarkeris displayed on the list, the color will be applied if the content is a label. A label rendered inside a map's pin cannot be colored and will always use the default color as chosen by the host.
Unless set with this method, the host will use a default color for the marker.
The host may ignore this color and use the default instead if the color does not pass the contrast requirements.
A color cannot be set if the marker's icon type is of TYPE_IMAGE.
| Throws | |
|---|---|
java.lang.NullPointerException |
if the |
setIcon
public @NonNull PlaceMarker.Builder setIcon(@NonNull CarIcon icon, int iconType)
Sets the icon to display in the marker.
Unless set with this method, the marker will not have an icon.
If a label is specified with setLabel, the icon will take precedence over it.
See CarIcon for more details related to providing icon and image resources that work with different car screen pixel densities.
| Parameters | |
|---|---|
@NonNull CarIcon icon |
the |
int iconType |
one of |
| Throws | |
|---|---|
java.lang.NullPointerException |
if the |
setLabel
public @NonNull PlaceMarker.Builder setLabel(@NonNull CharSequence label)
Sets the text that should be displayed as the marker's content.
Unless set with this method, the marker will not have a label.
If an icon is specified with setIcon, the icon will take precedence.
Spans are not supported in the input string and will be ignored.
| Parameters | |
|---|---|
@NonNull CharSequence label |
the text to display inside of the marker. The string must have a maximum size of 3 characters. Set to |
| Throws | |
|---|---|
java.lang.NullPointerException |
if the |
| See also | |
|---|---|
CarText |