android學習筆記11

來源:互聯網
上載者:User

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
              

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.