ImageVerifierCode 换一换
格式:DOC , 页数:19 ,大小:75.54KB ,
资源ID:2399450      下载积分:8 金币
验证码下载
登录下载
邮箱/手机:
验证码: 获取验证码
温馨提示:
支付成功后,系统会自动生成账号(用户名为邮箱或者手机号,密码是验证码),方便下次登录下载和查询订单;
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/2399450.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  
声明  |  会员权益     获赠5币     写作写作

1、填表:    下载求助     留言反馈    退款申请
2、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
3、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
4、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
5、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前自行私信或留言给上传者【天****】。
6、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
7、本文档遇到问题,请及时私信或留言给本站上传会员【天****】,需本站解决可联系【 微信客服】、【 QQ客服】,若有其他问题请点击或扫码反馈【 服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【 版权申诉】”(推荐),意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4008-655-100;投诉/维权电话:4009-655-100。

注意事项

本文(android毕业设计方案外文资料翻译.doc)为本站上传会员【天****】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4008-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

android毕业设计方案外文资料翻译.doc

1、毕业设计(论文)外文资料翻译外文出处 Mark Murphy.Beginning Android 2 Chapter 33 Mapping with MapView and MapActivityOne of 谷歌s most popular services-after search of course-is 谷歌 Maps, which lets you find everything from the nearest pizza parlor to directions from New York City to San Francisco (only 2,905 miles!), al

2、ong with supplying street views and satellite imagery.Most Android devices, not surprisingly, integrate 谷歌 Maps. For those that do, there is a mapping activity available to users directly from the main Android launcher. More relevant to you, as a developer, are MapView and MapActivity, which allow y

3、ou to integrate maps into your own applications. Not only can you display maps, control the zoom level, and allow people to pan around, but you can tie in Androids location-based services (covered in Chapter 32) to show where the device is and where it is going.Fortunately, integrating basic mapping

4、 features into your Android project is fairly easy. And there is also a fair bit of power available to you, if you want to get fancy.Terms, Not of EndearmentIntegrating 谷歌 Maps into your own application requires agreeing to a fairly lengthy set of legal terms. These terms include clauses that you ma

5、y find unpalatable.If you are considering 谷歌 Maps, please review these terms closely to determine if your intended use will not run afoul of any clauses. You are strongly recommended to seek professional legal counsel if there are any potential areas of conflict.Also, keep your eyes peeled for other

6、 mapping options, based on other sources of map data, such as OpenStreetMap ().Piling OnAs of Android l.5, 谷歌 Maps is not strictly part of the Android SDK. Instead, it is part of the 谷歌 APIs add-on, an extension of the stock SDK. The Android add-on system provides hooks for other subsystems that may

7、 be part of some devices but not others.NOTE: 谷歌 Maps is not part of the Android open source project, and undoubtedly there will be some devices that lack 谷歌 Maps due to licensing issues. For example, at the time of this writing, the Archos 5 Android tablet does not have 谷歌 Maps.By and large, the fa

8、ct that 谷歌 Maps is in an add-on does not affect your day-to-day development. However, bear in mind the following:n You will need to create your project with a suitable target to ensure the 谷歌 Maps APIs will be available.n To test your 谷歌 Maps integration, you will also need an AVD that supports the

9、谷歌 Maps API.The Bare BonesFar and away the simplest way to get a map into your application is to create your own subclass of MapActivity. Like ListActivity, which wraps up some of the smarts behind having an activity dominated by a ListView, MapActivity handles some of the nuances of setting up an a

10、ctivity dominated by a MapView.In your layout for the MapActivity subclass, you need to add an element named, at the time of this writing, com.谷歌.android.maps.MapView. This is the longhand way to spell out the names of widget classes, by including the full package name along with the class name. Thi

11、s is necessary because MapView is not in the com.谷歌.android.widget namespace. You can give the MapView widget whatever android:id attribute value you want, plus handle all the layout details to have it render properly alongside your other widgets.However, you do need to have these two items: android

12、:apiKey, which in production will need to be a 谷歌 Maps API key android:clickable=true, if you want users to be able to click and pan through your mapFor example, from the Maps/NooYawk sample application, here is the main layout: com.谷歌.android.maps.MapView android:id=+id/map android:layout_width= fi

13、ll_parentandroid:layout_height=fill_parent android:apiKey= android:clickable=true /Well cover that mysterious apiKey later in this chapter, in the The Key to It All section. In addition, you will need a couple of extra things in your AndroidManifest.xml file: The INTERNET and ACCESS_COARSE_LOCATION

14、permissions (the latter for use with the MyLocationOverlay class, described later in this chapter) Inside your , a element withandroid:name =com.谷歌.android.maps, to indicate you are using one of the optional Android APIsHere is the AndroidManifest.xml file for NooYawk: That is pretty much all you ne

15、ed for starters, plus to subclass your activity from MapActivity. If you were to do nothing else, and built that project and tossed it in the emulator, you would get a nice map of the world. Note, however, that MapActivity is abstract. You need to implement isRouteDisplayed() to indicate if you are

16、supplying some sort of driving directions.In theory, users could pan around the map using the D-pad. However, thats not terribly useful when they have the whole world in their hands.Since a map of the world is not much good by itself, we need to add a few things, as described next.Exercising Your Co

17、ntrolYou can find your MapView widget by findViewById(), just as with any other widget. The widget itself offers a getMapController() method. Between the MapView and MapController, you have a fair bit of capability to determine what the map shows and how it behaves. The following sections cover zoom

18、 and center, the features you will most likely want to use.ZoomThe map of the world you start with is rather broad. Usually, people looking at a map on a phone will be expecting something a bit narrower in scope, such as a few city blocks.You can control the zoom level directly via the setZoom() met

19、hod on the MapController. This takes an integer representing the level of zoom, where 1 is the world view and 21 is the tightest zoom you can get. Each level is a doubling of the effective resolution: 1 has the equator measuring 256 pixels wide, while 21 has the equator measuring 268,435,456 pixels

20、wide. Since the phones display probably doesnt have 268,435,456 pixels in either dimension, the user sees a small map focused on one tiny corner of the globe. A level of 16 will show several city blocks in each dimension, which is probably a reasonable starting point for experimentation.If you wish

21、to allow users to change the zoom level, call setBuiltInZoomControls (true);, and the user will be able to zoom in and out of the map via zoom controls found at the bottom center of the map.CenterTypically, you will need to control what the map is showing, beyond the zoom level, such as the users cu

22、rrent location or a location saved with some data in your activity. To change the maps position, call setCenter() on the MapController.The setCenter() method takes a GeoPoint as a parameter. A GeoPoint represents a location, via latitude and longitude. The catch is that the GeoPoint stores latitude

23、and longitude as integers representing the actual latitude and longitude multiplied by 1E6. This saves a bit of memory versus storing a float or double, and it greatly speeds up some internal calculations Android needs to do to convert the GeoPoint into a map position. However, it does mean you must

24、 remember to multiply the real-world latitude and longitude by 1E6.Rugged TerrainJust as the 谷歌 Maps service you use on your full-size computer can display satellite imagery, so can Android maps.MapView offers toggleSatellite(), which, as the name suggests, toggles on and off the satellite perspecti

25、ve on the area being viewed. You can have the user trigger these via an options menu or, in the case of NooYawk, via key presses:Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) if (keyCode = KeyEvent.KEYCODE_S) map.setSatellite( ! map.isSatellite();return(true);else if(keycode= KeyEven

26、t.KEYCODE_Z) Map.dispalyZoomControls(true);Return(true); return(super.onKeyDown(keyCode, event);Layers upon LayersIf you have ever used the full-size edition of 谷歌 Maps, you are probably used to seeing things overlaid atop the map itself, such as pushpins indicating businesses near the location bein

27、g searched. In map parlance (and, for that matter, in many serious graphic editors), the pushpins are on a layer separate from than the map itself, and what you are seeing is the composition of the pushpin layer atop the map layer.Androids mapping allows you to create layers as well, so you can mark

28、 up the maps as you need to based on user input and your applications purpose. For example, NooYawk uses a layer to show where select buildings are located in the island of Manhattan.Overlay ClassesAny overlay you want to add to your map needs to be implemented as a subclass of Overlay. There is an

29、ItemizedOverlay subclass available if you are looking to add pushpins or the like; ItemizedOverlay simplifies this process.To attach an overlay class to your map, just call getOverlays() on your MapView and add () your Overlay instance to it, as we do here with a custom SitesOverlay:marker.setBounds

30、(0, 0, marker.getIntrinsicWidth(),marker.getIntrinsicHeight();map.getOverlays().add(new SitesOverlay(marker);We will take a closer look at that marker in the next section.Drawing the ItemizedOverlayAs the name suggests, ItemizedOverlay allows you to supply a list of points of interest to be displaye

31、d on the map-specifically, instances of OverlayItem. The overlay handles much of the drawing logic for you. Here are the minimum steps to make this work:1. Override ItemizedOverlay as your own subclass (in this example, SitesOverlay).2. In the constructor, build your roster of OverlayItem instances,

32、 and call populate() when they are ready for use by the overlay.3. Implement size() to return the number of items to be handled by the overlay.4. Override createItem() to return OverlayItem instances given an index.5. When you instantiate your ItemizedOverlay subclass, provide it with a Drawable tha

33、t represents the default icon (e.g., a pushpin) to display for each item.The marker from the NooYawk constructor is the Drawable used for step 5. It shows a pushpin.You may also wish to override draw() to do a better job of handling the shadow for your markers. While the map will handle casting a sh

34、adow for you, it appears you need to provide a bit of assistance for it to know where the bottom of your icon is, so it can draw the shadow appropriately.For example, here is SitesOverlay: private class SitesOverlay extends ItemizedOverlay private List items=new ArrayList(); private Drawable marker=

35、null;public SitesOverlay(Drawable marker)super(marker);this.marker=marker;items.add(new OverlayItem(getPoint(40.034,-73.04), UN, United Nations); items.add(new OverlayItem(getPoint(40.87,-73.17), Lincoln Center, Home of Jazz at Lincoln Center);items.add (new OverlayItem (getPoint(40.7655,-73.68), Ca

36、rnegie Hall, Where you go with practice, practice, practice);items.add(new OverlayItem(getPoint(40.99,-74.065), The Downtown Club, Original home of the Heisman Trophy);populate();Overrideprotected OverlayItem createItem(int i) return(items.get(i);Overridepublic void draw(Canvas canvas, MapView mapVi

37、ew, boolean shadow) super.draw(canvas, mapView, shadow);boundCenterBottom(marker);Overrideprotected boolean onTap(int i) Toast.makeText(NooYawk.this,items.get(i).getSnippet(),Toast.LENGTH_SHORT) .show();return(true);Overridepublic int size() return(items.size(); Handling Screen TapsAn Overlay subcla

38、ss can also implement onTap(), to be notified when the user taps the map, so the overlay can adjust what it draws. For example, in full-size 谷歌 Maps, clicking a pushpin pops up a bubble with information about the business at that pins location. With onTap(), you can do much the same in Android.The o

39、nTap() method for ItemizedOverlay receives the index of the OverlayItem that was clicked. It is up to you to do something worthwhile with this event.In the case of SitesOverlay, as shown in the preceding section, onTap() looks like this:Overrideprotected boolean onTap(int i) Toast.makeText(NooYawk.t

40、his,items.get(i).getSnippet(),Toast.LENGTH_SHORT).show();return(true),Here, we just toss up a short Toast with the snippet from the OverlayItem, returning true to indicate we handled the tap.My, Myself, and MyLocationOverlayAndroid has a built-in overlay to handle two common scenarios: Showing where

41、 you are on the map, based on GPS or other location-providing logic Showing where you are pointed, based on the built-in compass sensor, where availableAll you need to do is create a MyLocationOverlay instance, add it to your MapViews list of overlays, and enable and disable the desired features at

42、appropriate times.The at appropriate times notion is for maximizing battery life. There is no sense in updating locations or directions when the activity is paused, so it is recommended that you enable these features in onResume() and disable them in onPause().For example, NooYawk will display a com

43、pass rose using MyLocationOverlay. To do this, we first need to create the overlay and add it to the list of overlays:me=new MyLocationOverlay(this, map);map.getOverlays().add(me);Then we enable and disable the compass rose as appropriate:Overridepublic void onResume() super.onResume();me.enableComp

44、ass();Overridepublic void onPause()super.onPause(); me.disableCompass();The Key to It AllIf you actually download the source code for the book, compile the NooYawk project, install it in your emulator, and run it, you will probably see a screen with a grid and a couple of pushpins, but no actual map

45、s.Thats because the API key in the source code is invalid for your development machine. Instead, you will need to generate your own API key(s) for use with your application.Full instructions for generating API keys for development and production use can be found on the Android web site (). In the interest of brevity, lets focus on the narrow case o

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服