您的位置:首页 > 移动开发 > Android开发

android学习笔记11

2011-06-04 15:14 239 查看
google map:
    MapActivity
    MapView
    ListActivity
    添加权限
    指定activity标签中添加:<uses-library android:name="com.google.android.maps" />
   
    书写的类extends MapActivity,添加MapView组件,在manifest中添加网络权限
      <uses-permission android:name="android.permission.INTERNET" />和在<activity />标签中添加
      库使用<uses-library android:name="com.google.android.maps" />
    可以显示最基本的map
   
    缩放
    街道
   
    知识点:
        MapController对象的创建:MapView对象的getController()  setZone(5)缩放方法
        地图显示方式:MapView的setTraffic(true)交通  setSatellite(true)卫星  setStreetVeiw(false)街道
   
    GPS定位:
        使用的类:LocationManager = getSystemService(Context.LOCATION_SERVICE);
                  LocationListener.requestLocationUpdates(String provider, long minTime, float minDistance,
                                                          LocationListener listener)用以添加监听器
                       provider为位置提供者,枚举类型 LocationManager常量
                       minTime最短监听时间间隔
                       minDistance更新具体
                       listener位置监听器,重写一个回调函数
                
                 改变位置方法:
                       animateTo(GeoPoint point)
                 在requestLocationUpdates方法中,获取到经纬度后转换为GeoPoint对象,例子:
                      GeoPoint gpoint = new GeoPoint((int)(location.getAltitude() * 1E6),
                                       (int) (location.getLongitude() * 1E6));
                 mapController.animateTo(gpoint);
                
           测试在cmd中telnet localhost 5554
          
           实现地图的移动:
                mapView.getMapCenter().getLongitudeE6()// 经度
                mapView.getMapCenter().getLatitudeE6()// 纬度
               
                getLatitudSpan()//屏幕纬度间隙
               
               
           鼠标接触拖动地图:
               重写onTouchEvent(MotionEvent event)
               使用Projection类做射影,进行操作
              
              
           在地图上画图:  
               画图类:画布类android.graphics.Canvas
                       画笔类android.graphics.Paint
                       着笔点android.graphics.Point
                       绘画区域android.graphics.RectF
                       画笔样式android.graphics.Paint.Style
                      
                       Overlay转为MapView服务
          
           gps定位{跟踪}:
               ItemizedOverlay  多个Overlay的处理
               OverlayItem
              
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: