Examples | Maps SDK | Android | Mapbox

文章推薦指數: 80 %
投票人數:10人

Code examples for the Mapbox Maps SDK for Android. ... You can find additional examples for the Maps SDK on GitHub. Clone the repository and run the example ... Youareusinganoutdatedbrowserandwillencountersomeproblemswithourwebsite.Pleaseconsiderupgrading.UpgradeNowMapsSDKforAndroidSearchGuidesExamplesAPIReferenceTutorialsTroubleshootingAlldocsMapsSDKforAndroidExamplesExamplesFiltersSearchExampleapplicationonGitHubYoucanfindadditionalexamplesfortheMapsSDKonGitHub.ClonetherepositoryandruntheexampleapplicationfollowingtheinstructionsintheREADME.AddamarkertothemapUsetheMapboxAnnotationsAPI'sPointAnnotationManagertoaddasingleredmarkerpintothemap.DisplayasimplemapviewDisplayamapwiththeMapsSDKforAndroid.AddamarkersymbolAddablueteardrop-shapedmarkerimagetoastyleanddisplayitonthemapusingaSymbolLayer.AddaviewannotationAddaViewAnnotationtoaMapViewwhenthemapisclicked.AddanimatedweatherdataLoadarasterimagetoastyleusingImageSourceanddisplayitonamapasanimatedweatherdatausingRasterLayer.AddviewannotationtoapointannotationAddaViewAnnotationtoaMapViewandanchorittoapointannotation.AddviewannotationsconnectedtofeaturesAddaViewAnnotationtoaMapViewandanchorittoafeatureinasymbollayer.DisplaybuildingextrusionsExtrudethebuildinglayerintheMapboxLightstyleusingFillExtrusionLayerandsetupthelightposition.DisplaymultipleiconimagesinasymbollayerAddpointdataandseveralimagestoastyleandusetheswitchCaseandgetexpressionstochoosewhichimagetodisplayateachpointinaSymbolLayerbasedonadataproperty.Displaytheuser'slocationDisplaytheuser'slocationonamapwiththedefaultuserlocationpuck.DrawaGeoJSONlineLoadapolylinetoastyleusingGeoJsonSourceanddisplayitonamapusingLineLayer.Fly-tocameraanimationAnimatethecamerachangeswiththefly-toanimation.Thiscausesthecameratoeasefromastartingpointtoanenddestination.InsetmapShowasmallerinsetmapfragmentandlinkittoalargermapfortwomapinteraction.LocationcomponentShowslocationpuckonthemap.RestrictmappanningRestrictthemap\'sviewporttoaspecifiedsetofcoordinatesforgesture-basedcamerachanges.Theviewportcanstillbechangedprogrammatically.StylecirclescategoricallyAddpointdatatoastylefromavectortilesetandusethematchandgetexpressionstoassignthecolorofeachpointinaCircleLayerbasedonadataproperty.TintafilllayerAddanimagetoastyleanduseittodisplayapatterninthelanduseFillLayerintheMapboxStreetsstyle.TogglethevisibilityofalayerAllowtheusertotogglethevisibilityofaCircleLayeronamap.UsingcustomcameraanimationsAnimatethemapcameratoanewpositionusingcameraanimators.Individualcamerapropertiessuchaszoom,bearing,andcentercoordinatecanbeanimatedindependently.VisualizedataasaheatmapAddearthquakefrequencydatatoastylefromaGeoJSONfileandrenderitonamapusingaHeatmapLayer.



請為這篇文章評分?