PolygonOptions | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Constants | Inherited Constants | Fields | Ctors | Methods | Inherited Methods | [Expand All]
public final class

# PolygonOptions

extends Object
implements Parcelable

java.lang.Object
↳ | com.google.android.gms.maps.model.PolygonOptions

## Class Overview

Defines options for a polygon.

### Developer Guide

For more information, read the Polylines and Polygons developer guide.

## Summary

Constants
String | NULL |

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final PolygonOptionsCreator | CREATOR |

Public Constructors
| PolygonOptions() Creates polygon options.

Public Methods
PolygonOptions | add(LatLng point) Adds a vertex to the outline of the polygon being built.
PolygonOptions | add(LatLng... points) Adds vertices to the outline of the polygon being built.
PolygonOptions | addAll(Iterable<LatLng> points) Adds vertices to the outline of the polygon being built.
PolygonOptions | addHole(Iterable<LatLng> points) Adds a hole to the polygon being built.
int | describeContents()
PolygonOptions | fillColor(int color) Specifies the polygon's fill color, as 32-bit ARGB.
PolygonOptions | geodesic(boolean geodesic) Specifies whether to draw each segment of this polygon as a geodesic.
int | getFillColor() Gets the fill color set for this Options object.
List<List<LatLng>> | getHoles() Gets the holes set for this Options object.
List<LatLng> | getPoints() Gets the outline set for this Options object.
int | getStrokeColor() Gets the stroke color set for this Options object.
float | getStrokeWidth() Gets the stroke width set for this Options object.
float | getZIndex() Gets the zIndex set for this Options object.
boolean | isGeodesic() Gets the geodesic setting for this Options object.
boolean | isVisible() Gets the visibility setting for this Options object.
PolygonOptions | strokeColor(int color) Specifies the polygon's stroke color, as 32-bit ARGB.
PolygonOptions | strokeWidth(float width) Specifies the polygon's stroke width, in display pixels.
PolygonOptions | visible(boolean visible) Specifies the visibility for the polygon.
void | writeToParcel(Parcel out, int flags)
PolygonOptions | zIndex(float zIndex) Specifies the polygon's zIndex, i.e., the order in which it will be drawn.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final String NULL

Constant Value: "SAFE_PARCELABLE_NULL_STRING"

## Fields

#### public static final PolygonOptionsCreator CREATOR

## Public Constructors

#### public PolygonOptions ()

Creates polygon options.

## Public Methods

#### public PolygonOptions add (LatLng point)

Adds a vertex to the outline of the polygon being built.

##### Returns

- this `PolygonOptions` object with the given point added to the outline.

#### public PolygonOptions add (LatLng... points)

Adds vertices to the outline of the polygon being built.

##### Returns

- this `PolygonOptions` object with the given points added to the outline.

#### public PolygonOptions addAll (Iterable<LatLng> points)

Adds vertices to the outline of the polygon being built.

##### Returns

- this `PolygonOptions` object with the given points added to the outline.

#### public PolygonOptions addHole (Iterable<LatLng> points)

Adds a hole to the polygon being built.

##### Returns

- this `PolygonOptions` object with the given hole added.

#### public int describeContents ()

#### public PolygonOptions fillColor (int color)

Specifies the polygon's fill color, as 32-bit ARGB. The default color is black ( `0xff000000`).

##### Returns

- this `PolygonOptions` object with a new fill color set.

#### public PolygonOptions geodesic (boolean geodesic)

Specifies whether to draw each segment of this polygon as a geodesic. The default setting is `false`

##### Returns

- this `PolygonOptions` object with a new geodesic setting.

#### public int getFillColor ()

Gets the fill color set for this Options object.

##### Returns

- the fill color of the polygon in screen pixels.

#### public List<List<LatLng>> getHoles ()

Gets the holes set for this Options object.

##### Returns

- the list of `List`s specifying the holes of the polygon.

#### public List<LatLng> getPoints ()

Gets the outline set for this Options object.

##### Returns

- the list of `LatLng`s specifying the vertices of the outline of the polygon.

#### public int getStrokeColor ()

Gets the stroke color set for this Options object.

##### Returns

- the stroke color of the polygon in screen pixels.

#### public float getStrokeWidth ()

Gets the stroke width set for this Options object.

##### Returns

- the stroke width of the polygon in screen pixels.

#### public float getZIndex ()

Gets the zIndex set for this Options object.

##### Returns

- the zIndex of the polygon.

#### public boolean isGeodesic ()

Gets the geodesic setting for this Options object.

##### Returns

- `true` if the polygon segments should be geodesics; `false` if they should not be.

#### public boolean isVisible ()

Gets the visibility setting for this Options object.

##### Returns

- `true` if the polygon is to be visible; `false` if it is not.

#### public PolygonOptions strokeColor (int color)

Specifies the polygon's stroke color, as 32-bit ARGB. The default color is black ( `0xff000000`).

##### Returns

- this `PolygonOptions` object with a new stroke color set.

#### public PolygonOptions strokeWidth (float width)

Specifies the polygon's stroke width, in display pixels. The default width is 10.

##### Returns

- this `PolygonOptions` object with a new stroke width set.

#### public PolygonOptions visible (boolean visible)

Specifies the visibility for the polygon. The default visibility is `true`.

##### Returns

- this `PolygonOptions` object with a new visibility setting.

#### public void writeToParcel (Parcel out, int flags)

#### public PolygonOptions zIndex (float zIndex)

Specifies the polygon's zIndex, i.e., the order in which it will be drawn. See the documentation at the top of this class for more information about zIndex.

##### Returns

- this `PolygonOptions` object with a new zIndex set.