MarkerOptions

c class MarkerOptions 扩展对象
实现 Parcelable

定义标记的选项。

继承的常量摘要

字段摘要

public static final Creator<MarkerOptions> 创作者

公共构造函数摘要

公共方法摘要

MarkerOptions
anchor(float u, float v)
用于指定要位于标记图像中特定点的锚点。
整型
浮点数
getAnchorU()
锚点与左边缘之间的水平距离(标准化为 [0, 1])。
浮点数
getAnchorV()
锚点与上边缘之间的垂直距离(标准化为 [0, 1])。
位图
getIcon()
返回为此 MarkerOptions 对象设置的自定义图标。
LatLng
getPosition()
返回为此 MarkerOptions 对象设置的位置。
字符串
getTitle()
返回该 MarkerOptions 对象的标题。
MarkerOptions
icon(位图图标)
设置标记的图标。
MarkerOptions
position(LatLng latLng)
设置标记的位置。
MarkerOptions
title(String title)
设置标记的标题。
void
writeToParcel(Parcel out、int 标记)

继承的方法摘要

字段

public static final Creator<MarkerOptions> CREATOR

公共构造函数

public MarkerOptions ()

公共方法

public MarkerOptions anchor (float u, float v)

用于指定要位于标记图像中特定点的锚点。

锚点用于指定图标图片中某个点,该点锚定在地球表面上标记的位置。

锚点在连续空间 [0.0, 1.0] x [0.0, 1.0] 中指定,其中 (0, 0) 表示图片的左上角,(1, 1) 表示右下角。W x H 图像中的定位点是(W + 1) x(H + 1) 网格中最近的离散网格点,可通过缩放然后舍入获得。例如,在 4 x 2 的图片中,定位点 (0.7, 0.6) 会解析为位于 (3, 1) 处的网格点。

 *-----+-----+-----+-----*
 |     |     |     |     |
 |     |     |     |     |
 +-----+-----+-----+-----+
 |     |     |   X |     |   (U, V) = (0.7, 0.6)
 |     |     |     |     |
 *-----+-----+-----+-----*

 *-----+-----+-----+-----*
 |     |     |     |     |
 |     |     |     |     |
 +-----+-----+-----X-----+   (X, Y) = (3, 1)
 |     |     |     |     |
 |     |     |     |     |
 *-----+-----+-----+-----*
 

参数
u 锚点的 u 坐标,以图片宽度的比率(在 [0, 1] 范围内)表示
v 锚点的 v 坐标,以图片高度的比率(在 [0, 1] 范围内)表示
返回
  • 为其调用方法的对象,并设置新的锚点。

public int describeContents ()

public float getAnchorU ()

锚点与左边缘之间的水平距离(标准化为 [0, 1])。

返回
  • 锚点的 u 值。

public float getAnchorV ()

锚点与上边缘之间的垂直距离(标准化为 [0, 1])。

返回
  • 锚点的 v 值。

public Bitmap getIcon ()

返回为此 MarkerOptions 对象设置的自定义图标。

返回
  • 表示自定义图标的位图,或者,如果未设置自定义图标,则为 null

public LatLng getPosition ()

返回为此 MarkerOptions 对象设置的位置。

返回
  • 用于指定标记位置的 LatLng 对象;如果未设置位置,则为 null

public String getTitle ()

返回该 MarkerOptions 对象的标题。

返回
  • 标记的标题,如果未设置标题,则返回空字符串

public MarkerOptions icon (位图图标)

设置标记的图标。如果未提供图标,将使用默认图钉样式。

参数
图标 图标 Bitmap
返回
  • 方法被调用的对象,并设置新的图标

public MarkerOptions position (LatLng latLng)

设置标记的位置。

参数
latLng 要设置的新排名
返回
  • 方法被调用的对象,并将新位置设置为

public MarkerOptions title (String title)

设置标记的标题。默认标题是一个空字符串。

参数
标题 要设置的标题
返回
  • 此方法被调用的对象,并设置新的标题

public void writeToParcel (Parcel out, int flag)

参数
出局
flags