目录

public class PolylineOptions

Implements the Parcelable API and defines attributes for a polyline.

Public Fields

None.

Constructor

Construction Method
PolylineOptions()

Public Method Summary

Return typeMethod name
PolylineOptionscreateFromParcel(Parcel in)
PolylineOptions[]newArray(int size)
voidwriteToParcel(Parcel parcel, int flags)
PolylineOptionsadd(LatLng… points)
PolylineOptionsadd(LatLng point)
PolylineOptionsaddAll(Iterable<LatLng> points)
PolylineOptionsclickable(boolean clickable)
PolylineOptionscolor(int color)
PolylineOptionsendCap(Cap endCap)
PolylineOptionsgeodesic(boolean geodesic)
intgetColor()
CapgetEndCap()
intgetJointType()
List<PatternItem>getPattern()
List<LatLng>getPoints()
CapgetStartCap()
floatgetWidth()
floatgetZIndex()
booleanisClickable()
booleanisGeodesic()
booleanisVisible()
PolylineOptionsjointType(int jointType)
PolylineOptionspattern(List<PatternItem> pattern)
PolylineOptionsstartCap(Cap startCap)
PolylineOptionsvisible(boolean visible)
PolylineOptionswidth(float width)
PolylineOptionszIndex(float zIndex)

Public Methods

Method
public PolylineOptions add(LatLng… points)
Adds multiple vertices to a polyline.


Parameters:

Parameter nameParameter desc
pointsCoordinates of multiple vertices.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with multiple specified vertices.
Method
public PolylineOptions add(LatLng point)
Adds a vertex to a polyline.


Parameters:

Parameter nameParameter desc
pointCoordinates of a vertex.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new vertex.
Method
public PolylineOptions addAll(Iterable<LatLng> points)
Adds multiple vertices to a polyline.


Parameters:

Parameter nameParameter desc
pointsMultiple vertices.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with multiple specified vertices.
Method
public PolylineOptions clickable(boolean clickable)
Specifies whether a polyline is tappable.


Parameters:

Parameter nameParameter desc
clickableIndicates whether a polyline is tappable. The options are true (yes) and false (no). The default value is false.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new tappability setting.
Method
public PolylineOptions color(int color)
Sets the stroke color of a polyline.


Parameters:

Parameter nameParameter desc
colorColor in ARGB format. By default, the stroke color is black (0xff000000).


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new stroke color.
Method
public PolylineOptions endCap(Cap endCap)
Sets the end vertex of a polyline. By default, the end vertex is a ButtCap object.


Parameters:

Parameter nameParameter desc
endCapEnd vertex of a polyline.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new end vertex.
Method
public PolylineOptions geodesic(boolean geodesic)
Specifies whether to draw each segment of a polyline as a geodesic.


Parameters:

Parameter nameParameter desc
geodesicIndicates whether to draw each segment of a polyline as a geodesic. The options are true (yes) and false (no).


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new geodesic setting.
Method
public int getColor()
Obtains the stroke color of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
intColor in ARGB format. By default, the stroke color is black (0xff000000).
Method
public Cap getEndCap()
Obtains the end vertex of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
CapEnd vertex of a polyline.
Method
public int getJointType()
Obtains the joint type of all vertices of a polyline, except the start and end vertices.


Parameters:
None.
Return:

Return typeParameter desc
intJoint type of a polyline. The default value is DEFAULT.
Method
public List<PatternItem> getPattern()
Obtains the stroke pattern of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
List<PatternItem>Stroke pattern of a polyline.
Method
public List<LatLng> getPoints()
Obtains a set of all vertices of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
List<LatLng>Set of all vertices of a polyline.
Method
public Cap getStartCap()
Obtains the start vertex of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
CapStart vertex of a polyline.
Method
public float getWidth()
Obtains the stroke width of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
float

Stroke width of a polyline, in pixels.

Notice:
The stroke width returned by this API is one third of the actual width.
Method
public float getZIndex()
Obtains the z-index of a polyline.


Parameters:
None.
Return:

Return typeParameter desc
floatZ-index, which indicates the overlapping order of a polyline.
Method
public boolean isClickable()
Checks whether a polyline is tappable.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf a polyline is tappable, true is returned. Otherwise, false is returned.
Method
public boolean isGeodesic()
Checks whether each segment of a polyline is drawn as a geodesic.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf each segment is drawn as a geodesic, true is returned. Otherwise, false is returned.
Method
public boolean isVisible()
Checks whether a polyline is visible.


Parameters:
None.
Return:

Return typeParameter desc
booleanIf a polyline is visible, true is returned. Otherwise, false is returned.
Method
public PolylineOptions jointType(int jointType)
Sets the joint type of all vertices of a polyline, except the start and end vertices. For details of the allowed joint types, please refer to JointType. If the joint type is not set or not an allowed one, the default value DEFAULT is used.


Parameters:

Parameter nameParameter desc
jointTypeJoint type. The default value is DEFAULT.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new joint type.
Method
public PolylineOptions pattern(List<PatternItem> pattern)
Sets the stroke pattern of a polyline. By default, the stroke pattern is solid, represented by null.


Parameters:

Parameter nameParameter desc
patternPatternItem object set.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new stroke pattern.
Method
public PolylineOptions startCap(Cap startCap)
Sets the start vertex of a polyline. By default, the start vertex is a ButtCap object.


Parameters:

Parameter nameParameter desc
startCapStart vertex of a polyline.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new start vertex.
Method
public PolylineOptions visible(boolean visible)
Specifies whether a polyline is visible. If the polyline is invisible, it will not be drawn but all other states will be preserved.


Parameters:

Parameter nameParameter desc
visibleIndicates whether a polyline is visible. The default value is true.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new visibility setting.
Method
public PolylineOptions width(float width)
Sets the stroke width of a polyline.


Parameters:

Parameter nameParameter desc
width

Stroke width of a polyline, in pixels. The default value is 10.

Notice:
To ensure compatibility, the actual stroke width triples the passed parameter value.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new stroke width.
Method
public PolylineOptions zIndex(float zIndex)
Sets the z-index of a polyline. The z-index indicates the overlapping order of a polyline. A polyline with a larger z-index overlaps that with a smaller z-index. Polylines with the same z-index overlap each other in a random order. By default, the z-index is 0.


Parameters:

Parameter nameParameter desc
zIndexZ-index, which indicates the overlapping order of a polyline.


Return:

Return typeParameter desc
PolylineOptionsPolylineOptions object with a new z-index.