Class Info |
|---|
public class PolylineOptions Implements the Parcelable API and defines attributes for a polyline. |
Constructor Name |
|---|
PolylineOptions() Default constructor of the PolylineOptions class. |
Qualifier and Type | Method Name and Description |
|---|---|
PolylineOptions | Adds multiple vertices to a polyline. |
PolylineOptions | Adds a vertex to a polyline. |
PolylineOptions | addAll(Iterable<LatLng> points) Adds a group of vertices to a polyline. |
PolylineOptions | clickable(boolean clickable) Sets whether a polyline is tappable. |
PolylineOptions | color(int color) Sets the stroke color of a polyline. |
PolylineOptions | colorValues(List<Integer> colors) Sets colors for different segments of a polyline. |
PolylineOptions | Sets the end vertex cap of a polyline. |
PolylineOptions | geodesic(boolean geodesic) Sets whether to draw each segment of a polyline as a geodesic. |
| Obtains the end vertex cap of a polyline. | |
List<PatternItem> | Obtains the stroke pattern of a polyline. |
| Obtains the start vertex cap of a polyline. | |
PolylineOptions | jointType(int jointType) Sets the joint type of all vertices of a polyline, except the start and end vertices. For details about the allowed joint types, please refer to JointType. |
PolylineOptions | pattern(List<PatternItem> pattern) Sets the stroke pattern of a polyline. |
PolylineOptions | Sets the start vertex cap of a polyline. |
PolylineOptions | visible(boolean visible) Sets whether a polyline is visible. |
PolylineOptions | width(float width) Sets the stroke width of a polyline. |
PolylineOptions | zIndex(float zIndex) Sets the z-index of a polyline. |
PolylineOptions | gradient(boolean on) Sets whether a polyline is gradient. |
Method |
|---|
public PolylineOptions add(LatLng... points) Adds multiple vertices to a polyline. |
Parameters
Name | Description |
|---|---|
points | Coordinates of multiple vertices. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object containing the specified vertices. |
Method |
|---|
public PolylineOptions add(LatLng point) Adds a vertex to a polyline. |
Parameters
Name | Description |
|---|---|
point | Coordinates of a vertex. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new vertex setting. |
Method |
|---|
public PolylineOptions addAll(Iterable<LatLng> points) Adds a group of vertices to a polyline. |
Parameters
Name | Description |
|---|---|
points | Multiple vertices. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object containing the specified vertices. |
Method |
|---|
public PolylineOptions clickable(boolean clickable) Sets whether a polyline is tappable. |
Parameters
Name | Description |
|---|---|
clickable | Indicates whether a polyline is tappable.
The default value is false. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new tappability setting. |
Method |
|---|
public PolylineOptions color(int color) Sets the stroke color of a polyline. |
Parameters
Name | Description |
|---|---|
color | Color in ARGB format. By default, the stroke color is black (0xff000000). |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new polyline stroke color. |
Method |
|---|
public PolylineOptions colorValues(List<Integer> colors) Sets colors for different segments of a polyline. |
Parameters
Name | Description |
|---|---|
colors | Colors of different segments of a polyline, in ARGB format. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object containing the set colors. |
Method |
|---|
public PolylineOptions endCap(Cap endCap) Sets the end vertex cap of a polyline. |
Parameters
Name | Description |
|---|---|
endCap | End vertex cap of a polyline. The default value is ButtCap. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new end vertex cap setting. |
Method |
|---|
public PolylineOptions geodesic(boolean geodesic) Sets whether to draw each segment of a polyline as a geodesic. If this parameter is not set, the default value false will be returned. |
Parameters
Name | Description |
|---|---|
geodesic | Indicates whether to draw each segment of a polyline as a geodesic.
|
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new geodesic attribute setting. |
Method |
|---|
public List<PatternItem> getPattern() Obtains the stroke pattern of a polyline. |
Returns
Type | Description |
|---|---|
List<PatternItem> | Stroke pattern of a polyline. |
Method |
|---|
public PolylineOptions jointType(int jointType) Sets the joint type of all vertices of a polyline, except the start and end vertices. For details about the allowed joint types, please refer to JointType. If the joint type is not set or not an allowed one, the default value DEFAULT will be used. |
Parameters
Name | Description |
|---|---|
jointType | Joint type. The default value is DEFAULT. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new joint type. |
Method |
|---|
public PolylineOptions pattern(List<PatternItem> pattern) Sets the stroke pattern of a polyline. |
Parameters
Name | Description |
|---|---|
pattern | PatternItem object set. The default value is null, indicating that the stroke is in the solid pattern. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new pattern setting. |
Method |
|---|
public PolylineOptions startCap(Cap startCap) Sets the start vertex cap of a polyline. |
Parameters
Name | Description |
|---|---|
startCap | Start vertex cap. The default value is ButtCap. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new start vertex cap setting. |
Method |
|---|
public PolylineOptions visible(boolean visible) Sets whether a polyline is visible. If the polyline is invisible, it will not be drawn but all other states will be preserved. |
Parameters
Name | Description |
|---|---|
visible | Indicates whether a polyline is visible.
The default value is true. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new visibility setting. |
Method |
|---|
public PolylineOptions width(float width) Sets the stroke width of a polyline. |
Parameters
Name | Description |
|---|---|
width | Stroke width of a polyline, in pixels. The default value is 10. NOTE: To ensure compatibility, the actual stroke width triples the passed parameter value. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new polyline stroke width. |
Throws
Name | Description |
|---|---|
IllegalArgumentException | If the passed stroke width is a negative number. |
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 by the order in which they are added. |
Parameters
Name | Description |
|---|---|
zIndex | Z-index, which indicates the overlapping order of a polyline. By default, the z-index is 0. |
Returns
Type | Description |
|---|---|
PolylineOptions | PolylineOptions object with the new z-index. |