2013年5月3日 星期五

Android程式設計 - Google Maps API v2 地圖定位

使用My location圖層是最簡便的定位方式,其概念像是在地圖上覆蓋透明圖層,當我們啟用my-location圖層後,定位點內容自然會疊覆到地圖上。
程式中可使用GoogleMap.setMyLocationEnabled()方法來開啟或關閉My location圖層。例如:
  GoogleMap m_map = ((SupportMapFragment)
     getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
  m_map.setMyLocationEnabled(true);