您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > android毕业设计外文资料翻译
毕业设计(论文)外文资料翻译外文出处MarkMurphy.BeginningAndroid2Chapter331MappingwithMapViewandMapActivityOneofGoogle'smostpopularservices-aftersearchofcourse-isGoogleMaps,whichletsyoufindeverythingfromthenearestpizzaparlortodirectionsfromNewYorkCitytoSanFrancisco(only2,905miles!),alongwithsupplyingstreetviewsandsatelliteimagery.MostAndroiddevices,notsurprisingly,integrateGoogleMaps.Forthosethatdo,thereisamappingactivityavailabletousersdirectlyfromthemainAndroidlauncher.Morerelevanttoyou,asadeveloper,areMapViewandMapActivity,whichallowyoutointegratemapsintoyourownapplications.Notonlycanyoudisplaymaps,controlthezoomlevel,andallowpeopletopanaround,butyoucantieinAndroid'slocation-basedservices(coveredinChapter32)toshowwherethedeviceisandwhereitisgoing.Fortunately,integratingbasicmappingfeaturesintoyourAndroidprojectisfairlyeasy.Andthereisalsoafairbitofpoweravailabletoyou,ifyouwanttogetfancy.Terms,NotofEndearmentIntegratingGoogleMapsintoyourownapplicationrequiresagreeingtoafairlylengthysetoflegalterms.Thesetermsincludeclausesthatyoumayfindunpalatable.IfyouareconsideringGoogleMaps,pleasereviewthesetermscloselytodetermineifyourintendedusewillnotrunafoulofanyclauses.Youarestronglyrecommendedtoseekprofessionallegalcounselifthereareanypotentialareasofconflict.Also,keepyoureyespeeledforothermappingoptions,basedonothersourcesofmapdata,suchasOpenStreetMap().PilingOnAsofAndroidl.5,GoogleMapsisnotstrictlypartoftheAndroidSDK.Instead,itispartoftheGoogleAPIsadd-on,anextensionofthestockSDK.TheAndroidadd-onsystemprovideshooksforothersubsystemsthatmaybepartofsomedevicesbutnotothers.NOTE:GoogleMapsisnotpartoftheAndroidopensourceproject,andundoubtedlytherewillbesomedevicesthatlackGoogleMapsduetolicensingissues.Forexample,atthetimeofthiswriting,theArchos5Androidtabletdoes2nothaveGoogleMaps.Byandlarge,thefactthatGoogleMapsisinanadd-ondoesnotaffectyourday-to-daydevelopment.However,bearinmindthefollowing:YouwillneedtocreateyourprojectwithasuitabletargettoensuretheGoogleMapsAPIswillbeavailable.TotestyourGoogleMapsintegration,youwillalsoneedanAVDthatsupportstheGoogleMapsAPI.TheBareBonesFarandawaythesimplestwaytogetamapintoyourapplicationistocreateyourownsubclassofMapActivity.LikeListActivity,whichwrapsupsomeofthesmartsbehindhavinganactivitydominatedbyaListView,MapActivityhandlessomeofthenuancesofsettingupanactivitydominatedbyaMapView.InyourlayoutfortheMapActivitysubclass,youneedtoaddanelementnamed,atthetimeofthiswriting,com.google.android.maps.MapView.Thisisthelonghandwaytospelloutthenamesofwidgetclasses,byincludingthefullpackagenamealongwiththeclassname.ThisisnecessarybecauseMapViewisnotinthecom.google.android.widgetnamespace.YoucangivetheMapViewwidgetwhateverandroid:idattributevalueyouwant,plushandleallthelayoutdetailstohaveitrenderproperlyalongsideyourotherwidgets.However,youdoneedtohavethesetwoitems:android:apiKey,whichinproductionwillneedtobeaGoogleMapsAPIkeyandroid:clickable=true,ifyouwantuserstobeabletoclickandpanthroughyourmapForexample,fromtheMaps/NooYawksampleapplication,hereisthemainlayout:?xmlversion=l.0encoding=utf-8?RelativeLayoutxmlns:android=:layout_width=fill_parentandroid:layout_height=fill_parentcom.google.android.maps.MapViewandroid:id=@+id/mapandroid:layout_width=fill_parentandroid:layout_height=fill_parentandroid:apiKey=YOUR_API_KEYandroid:clickable=true//RelativeLayout3We'llcoverthatmysteriousapiKeylaterinthischapter,intheTheKeytoItAllsection.Inaddition,youwillneedacoupleofextrathingsinyourAndroidManifest.xmlfile:TheINTERNETandACCESS_COARSE_LOCATIONpermissions(thelatterforusewiththeMyLocationOverlayclass,describedlaterinthischapter)Insideyourapplication,auses-libraryelementwithandroid:name=com.google.android.maps,toindicateyouareusingoneoftheoptionalAndroidAPIsHereistheAndroidManifest.xmlfileforNooYawk:?xmlversion=”1.0”encoding=”utf-8”?manifestxmlns:android=””package=com.commonsware.android.maps”uses-permissionandroid:name=”android.permission.INTERNET”/uses-permissionandroid:name=”android.permission.ACCESS_COARES_LOCATION”/applicationandroid:label=@string/app_nameandroid:icon=@drawable/cwuses-libraryandroid:name=”com.google.android.maps/activityandroid:name=.NooYawk”android:label=@string/app_nameintent-filteractionandroid:name=android.intent.action.MAIN/categoryandroid:name=android.intent.category.LAUNCHER//intent-filter/activity/application/manifestThatisprettymuchallyouneedforstarters,plustosubclassyouractivityfromMapActivity.Ifyouweretodonothingelse,andbuiltthatprojectandtosseditintheemulator,youwouldgetanicemapoftheworld.Note,however,thatMapActivityisabstract.YouneedtoimplementisRouteDisplayed()toindicateifyouaresupplyingsomesortofdrivingdirections.Intheory,userscouldpanaroundthemapusingtheD-pad.However,that'snotterriblyusefulwhentheyhavethewholeworldintheirhands.4Sinceamapoftheworldisnotmuchgoodbyitself,weneedtoaddafewthings,asdescribednext.ExercisingYourContr
本文标题:android毕业设计外文资料翻译
链接地址:https://www.777doc.com/doc-4034429 .html