Stay organized with collections Save and categorize content based on your preferences.
A circle on the earth's surface (spherical cap).
A circle has the following properties.
LatLng
.
Color
. The default value is black (0xff000000
).
null
) or a sequence of PatternItem
objects to be repeated along the circle's outline. Available PatternItem
types: Gap
(defined by gap length in pixels), Dash
(defined by stroke width and dash length in pixels) and Dot
(circular, centered on the circle's outline, diameter defined by stroke width in pixels).
Color
. The default value is transparent (0x00000000
).
GroundOverlay
s, TileOverlay
s, Polyline
s, and Polygon
s but not Marker
s). An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index is arbitrary. The default zIndex is 0.
true
, i.e., visible.
Object
associated with the circle. For example, the Object
can contain data about what the circle represents. This is easier than storing a separate Map<Circle, Object>
. As another example, you can associate a String
ID corresponding to the ID from a data set. Google Maps SDK for Android neither reads nor writes this property.
Methods in this class must be called on the Android UI thread. If not, an IllegalStateException
will be thrown at runtime.
GoogleMap map;
// ... get a map.
// Add a circle in Sydney
Circle circle = map.addCircle(new CircleOptions()
.center(new LatLng(-33.87365, 151.20689))
.radius(10000)
.strokeColor(Color.RED)
.fillColor(Color.BLUE));
Note that the current map renderer is unable to draw the circle fill if the circle encompasses either the North or South pole. However, the outline will still be drawn correctly.
Developer GuideFor more information, read the Shapes developer guide.
Public Method Summary Inherited Method Summary From class java.lang.Object Objectclone()
boolean voidfinalize()
final Class<?>getClass()
inthashCode()
final voidnotify()
final voidnotifyAll()
StringtoString()
final voidwait(long arg0, int arg1)
final voidwait(long arg0)
final voidwait()
Public Methods public LatLng getCenter ()Returns the center as a LatLng
.
LatLng
.Returns the fill color of this Circle.
ReturnsGets this circle's id. The id will be unique amongst all Circles on a map.
public double getRadius ()Returns the circle's radius, in meters.
ReturnsReturns the stroke color.
ReturnsReturns the stroke pattern of this circle's outline.
Returnsnull
if default solid stroke pattern is used.Returns the stroke width.
ReturnsGets the tag for the circle.
Returns setTag(Object)
; null
if no tag has been set.Returns the zIndex.
ReturnsChecks whether the circle is visible.
Returnstrue
if the circle is visible; false
if it is invisible.Removes this circle from the map. After a circle has been removed, the behavior of all its methods is undefined.
public void setCenter (LatLng center)Sets the center using a LatLng
.
The center must not be null
, as there is no default value.
LatLng
. public void setClickable (boolean clickable) public void setFillColor (int color)
Sets the fill color.
The fill color is the color inside the circle, in the integer format specified by Color
. If TRANSPARENT is used then no fill is drawn.
Color
format. public void setRadius (double radius)
Sets the radius in meters.
The radius must be zero or greater.
Parameters radius The radius, in meters. public void setStrokeColor (int color)Sets the stroke color.
The stroke color is the color of this circle's outline, in the integer format specified by Color
. If TRANSPARENT is used then no outline is drawn.
Color
format. public void setStrokePattern (List<PatternItem> pattern)
Sets the stroke pattern of the circle's outline. The default stroke pattern is solid, represented by null
.
Sets the stroke width.
The stroke width is the width (in screen pixels) of the circle's outline. It must be zero or greater. If it is zero then no outline is drawn. The default value is 10.
Parameters width The stroke width, in screen pixels. public void setTag (Object tag)Sets the tag for the circle.
You can use this property to associate an arbitrary Object
with this circle. For example, the Object
can contain data about what the circle represents. This is easier than storing a separate Map<Circle, Object>
. As another example, you can associate a String
ID corresponding to the ID from a data set. Google Maps SDK for Android neither reads nor writes this property. It is your responsibility to call setTag(null)
to clear the tag when you no longer need it, to prevent memory leaks in your app.
null
, the tag is cleared. public void setVisible (boolean visible)
Sets the visibility of the circle.
If this circle is not visible then it will not be drawn. All other state is preserved. Circles are visible by default.
Parameters visibletrue
to make this circle visible; false
to make it invisible. public void setZIndex (float zIndex)
Sets the zIndex.
Overlays (such as circles) with higher zIndices are drawn above those with lower indices.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`Circle` objects represent circles drawn on a map, defined by center coordinates, radius, and visual properties like color and stroke."],["Circles can be customized with fill and stroke colors, stroke patterns, and z-index for layering."],["Developers can access and modify properties of a `Circle`, such as center, radius, and visibility."],["Clickability can be enabled for `Circle` objects to respond to user interactions."],["Circles are added to the map and removed using methods provided in the Google Maps SDK for Android."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4