• <ul id="8aeke"><sup id="8aeke"></sup></ul>
    <tfoot id="8aeke"></tfoot>
    <del id="8aeke"></del>
    <abbr id="8aeke"></abbr>
      <strike id="8aeke"><menu id="8aeke"></menu></strike>
    • <tfoot id="8aeke"></tfoot>
    • 安卓開發高德gis地圖,高德地圖手機app

      2024-05-05 GIS 55
      A?AA?

      本篇文章給大家談談安卓開發高德gis地圖,以及高德地圖手機app對應的知識點,希望對各位有所幫助,不要忘了收藏本站喔。

      目錄一覽:

      android開發如何用高德地圖進行模擬定位.

      一、 要實現高德地圖定位呢,首先需要做好以下幾步準備:

      1. 在高德開放平臺注冊帳號

      2. 在開發中下載Android平臺下的地圖SDK和定位SDK文件

      進入相關下載下載自己想要的功能或文件,圖只是截取了地圖SDK的頁面,定位SDK也是一樣,按自己想要的文件下載。下載完成后解壓得到:

      微信號:MeetyXiao
      添加微信好友, 獲取更多信息
      復制微信號

      - 3D地圖包解壓后得到:3D地圖顯示包“AMap_3DMap_VX.X.X_時間.jar”和庫文件夾(包含armeabi、arm64-v8a等庫文件)。

      - 2D地圖包解壓后得到:2D地圖顯示包“AMap_2DMap_VX.X.X_時間.jar ”

      - 定位SDK下載并解壓得到定位包“AMap_Location_V2.x.x.jar“

      3. 添加jar包,將jar包放入工程的libs目錄下。

      對于每個jar文件,右鍵-選擇Add As Library,導入到工程中。或者使用菜單欄 選擇 File -Project Structure-Modules- Dependencies。點擊綠色的加號選擇File dependency. 然后選擇要添加的jar包即可,此時build.gradle中會自動生成如下信息。

      創建自己的應用(創建過程內需要的SHA1已經的博客講過)

      開發環境已經配置好了,接下來就是敲代碼了。

      二、 首先我們要做的就是將地圖顯示出來,通過以下幾步操作,即可在應用中使用高德地圖SDK:

      之一步:添加用戶key 在工程的“ AndroidManifest.xml ”文件如下代碼中添加您的用戶 Key。

      application

      android:allowBackup="true"

      android:icon="@mipmap/ic_launcher"

      android:label="@string/app_name"

      android:supportsRtl="true"

      android:theme="@style/AppTheme"

      meta-data

      android:name="com.amap.api.v2.apikey"

      android:value="c9df032baec3ec50b1e089768ea4672b" /123456789

      第二步:添加所需權限 在工程的“ AndroidManifest.xml ”文件中進行添加。

      //地圖包、搜索包需要的基礎權限

      uses-permission android:name="android.permission.INTERNET" /

      uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /

      uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /

      uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /

      uses-permission android:name="android.permission.READ_PHONE_STATE" /

      uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /

      //定位包、導航包需要的額外權限(注:基礎權限也需要)

      uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /

      uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /

      uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /

      uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /1234567891011121314

      第三步:在布局xml文件中添加地圖控件。

      com.amap.api.maps2d.MapView

      android:id="@+id/map_view"

      android:layout_width="match_parent"

      android:layout_height="match_parent" /1234

      第四步,創建地圖Activity,管理地圖生命周期。

      public class MainActivity extends Activity {

      private MapView mMapView = null;

      @Override

      protected void onCreate(Bundle savedInstanceState) {

      super.onCreate(savedInstanceState);

      setContentView(R.layout.activity_main);

      //獲取地圖控件引用

      mMapView = (MapView) findViewById(R.id.map_view);

      //在activity執行onCreate時執行mMapView.o

      mMapView.onCreate(savedInstanceState);

      }

      @Override

      protected void onDestroy() {

      super.onDestroy();

      //在activity執行onDestroy時執行mMapView.onDestroy(),實現地圖生命周期管理

      mMapView.onDestroy();

      }

      @Override

      protected void onResume() {

      super.onResume();

      //在activity執行onResume時執行mMapView.onResume (),實現地圖生命周期管理

      mMapView.onResume();

      }

      @Override

      protected void onPause() {

      super.onPause();

      //在activity執行onPause時執行mMapView.onPause (),實現地圖生命周期管理

      mMapView.onPause();

      }

      @Override

      protected void onSaveInstanceState(Bundle outState) {

      super.onSaveInstanceState(outState);

      //在activity執行onSaveInstanceState時執行mMapView.onSaveInstanceState (outState),實現地圖生命周期管理

      mMapView.onSaveInstanceState(outState);

      }

      }12345678910111213141516171819202122232425262728293031323334353637

      注意:一定要有mMapView.onCreate(savedInstanceState);

      第二步:啟動定位功能:

      1. 在主線程中獲得地圖對象AMap,并設置定位監聽且實現LocationSource接口:

      public class MainActivity extends Activity implements LocationSource{1

      if (aMap == null) {

      aMap = mMapView.getMap();

      //設置顯示定位按鈕 并且可以點擊

      UiSettings settings = aMap.getUiSettings();

      aMap.setLocationSource(this);//設置了定位的監聽,這里要實現LocationSource接口

      // 是否顯示定位按鈕

      settings.setMyLocationButtonEnabled(true);

      aMap.setMyLocationEnabled(true);//顯示定位層并且可以觸發定位,默認是flase

      }123456789

      2. 配置定位參數,啟動定位

      //初始化定位

      mLocationClient = new AMapLocationClient(getApplicationContext());

      //設置定位回調監聽,這里要實現AMapLocationListener接口,AMapLocationListener接口只有onLocationChanged *** 可以實現,用于接收異步返回的定位結果,參數是AMapLocation類型。

      mLocationClient.setLocationListener(this);

      //初始化定位參數

      mLocationOption = new AMapLocationClientOption();

      //設置定位模式為Hight_Accuracy高精度模式,Battery_Saving為低功耗模式,Device_Sensors是僅設備模式

      mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);

      //設置是否返回地址信息(默認返回地址信息)

      mLocationOption.setNeedAddress(true);

      //設置是否只定位一次,默認為false

      mLocationOption.setOnceLocation(false);

      //設置是否強制刷新WIFI,默認為強制刷新

      mLocationOption.setWifiActiveScan(true);

      //設置是否允許模擬位置,默認為false,不允許模擬位置

      mLocationOption.setMockEnable(false);

      //設置定位間隔,單位毫秒,默認為2000ms

      mLocationOption.setInterval(2000);

      //給定位客戶端對象設置定位參數

      mLocationClient.setLocationOption(mLocationOption);

      //啟動定位

      mLocationClient.startLocation();12345678910111213141516171819202122

      高精度定位模式:

      在這種定位模式下,將同時使用高德 *** 定位和GPS定位,優先返回精度高的定位

      低功耗定位模式:

      在這種模式下,將只使用高德 *** 定位

      僅設備定位模式:

      在這種模式下,將只使用GPS定位。

      3. 實現AMapLocationListener接口,獲取定位結果:

      public class MainActivity extends Activity implem

      @Override

      public void onLocationChanged(AMapLocation aMapLocation) {

      if (aMapLocation != null) {

      if (aMapLocation.getErrorCode() == 0) {

      //定位成功回調信息,設置相關消息

      aMapLocation.getLocationType();//獲取當前定位結果來源,如 *** 定位結果,詳見官方定位類型表

      aMapLocation.getLatitude();//獲取緯度

      aMapLocation.getLongitude();//獲取經度

      aMapLocation.getAccuracy();//獲取精度信息

      SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

      Date date = new Date(aMapLocation.getTime());

      df.format(date);//定位時間

      aMapLocation.getAddress();//地址,如果option中設置isNeedAddress為false,則沒有此結果, *** 定位結果中會有地址信息,GPS定位不返回地址信息。

      aMapLocation.getCountry();//國家信息

      aMapLocation.getProvince();//省信息

      aMapLocation.getCity();//城市信息

      aMapLocation.getDistrict();//城區信息

      aMapLocation.getStreet();//街道信息

      aMapLocation.getStreetNum();//街道門牌號信息

      aMapLocation.getCityCode();//城市編碼

      aMapLocation.getAdCode();//地區編碼

      // 如果不設置標志位,此時再拖動地圖時,它會不斷將地圖移動到當前的位置

      if (isFirstLoc) {

      //設置縮放級別

      aMap.moveCamera(CameraUpdateFactory.zoomTo(17));

      //將地圖移動到定位點

      aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude())));

      //點擊定位按鈕 能夠將地圖的中心移動到定位點

      mListener.onLocationChanged(aMapLocation);

      //獲取定位信息

      StringBuffer buffer = new StringBuffer();

      buffer.append(aMapLocation.getCountry() + ""

      + aMapLocation.getProvince() + ""

      + aMapLocation.getCity() + ""

      + aMapLocation.getProvince()

      + aMapLocation.getDistrict() + ""

      + aMapLocation.getStreet() + ""

      + aMapLocation.getStreetNum());

      Toast.makeText(getApplicationContext(), buffer.toString(), Toast.LENGTH_LONG).show();

      isFirstLoc = false;

      }

      } else {

      //顯示錯誤信息ErrCode是錯誤碼,errInfo是錯誤信息,詳見錯誤碼表。

      Log.e("AmapError", "location Error, ErrCode:"

      + aMapLocation.getErrorCode() + ", errInfo:"

      + aMapLocation.getErrorInfo());

      Toast.makeText(getApplicationContext(), "定位失敗", Toast.LENGTH_LONG).show();

      }

      }

      }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051

      4.關于停止定位

      @Override

      protected void onDestroy() {

      super.onDestroy();

      mapView.onDestroy();

      //mLocationClient.stopLocation();//停止定位

      mLocationClient.onDestroy();//銷毀定位客戶端。

      //銷毀定位客戶端之后,若要重新開啟定位請重新New一個AMapLocationClient對象。

      }

      //激活定位

      @Override

      public void activate(OnLocationChangedListener onLocationChangedListener) {

      mListener = onLocationChangedListener;

      }

      @Override

      public void deactivate() {

      mListener = null;

      }12345678910111213141516171819

      怎么用java開發安卓 高德地圖

      首先創建工程,并在工程Build PathConfigure Build Path…libraries 中選擇“Add Externel JARs…”,選定

      MapApi.jar,點擊OK,這樣就可以將高德地圖Android API 庫文件引入。然后在工程Build PathConfigure Build

      Path…Order and Export 中將引入的庫文件MapApi.jar 選中,點擊OK,這樣您就可以在您的程序中使用高德地圖API

      了。

      二、我們在不熟悉的情況下、先盡量多的添加此軟件應用權限;所以在mainifest中添加如下代碼;插入的位置在

      application的代碼之前。

      Java代碼

      uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/uses-permission

      uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/uses-permission

      uses-permission android:name="android.permission.INTERNET"/uses-permission

      uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/uses-permission

      uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/uses-permission

      uses-permission android:name="android.permission.READ_PHONE_STATE"/uses-permission

      uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/uses-permission

      uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/uses-permission

      高德地圖,android開發中,怎么用經緯度來顯示地圖?

      首先創建工程,并在工程Build PathConfigure Build Path…libraries 中選擇“Add Externel JARs…”,選定

      MapApi.jar,點擊OK,這樣就可以將高德地圖Android API 庫文件引入。然后在工程Build PathConfigure Build

      Path…Order and Export 中將引入的庫文件MapApi.jar 選中,點擊OK,這樣您就可以在您的程序中使用高德地圖API

      了。

      二、我們在不熟悉的情況下、先盡量多的添加此軟件應用權限;所以在mainifest中添加如下代碼;插入的位置在

      application的代碼之前。

      Java代碼

      uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/uses-permission

      uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/uses-permission

      uses-permission android:name="android.permission.INTERNET"/uses-permission

      uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/uses-permission

      uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/uses-permission

      uses-permission android:name="android.permission.READ_PHONE_STATE"/uses-permission

      uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/uses-permission

      uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/uses-permission

      三、接著就要在res文件下的layout中添加界面布局了。其代碼如下、你可以完全復制進去。

      Java代碼

      ?xml version="1.0" encoding="utf-8"?

      LinearLayout xmlns:android=""

      android:orientation="vertical"

      android:layout_width="fill_parent"

      android:layout_height="fill_parent"

      !--添加文本輸入框,查找地址--

      LinearLayout

      android:layout_height="wrap_content"

      android:layout_width="wrap_content" android:orientation="horizontal"

      xmlns:android=""

      android:layout_gravity="center_horizontal"

      TextView android:layout_height="wrap_content"

      android:layout_width="wrap_content"

      android:text="經度"/

      EditText android:layout_height="fill_parent"

      android:layout_width="100px"

      android:id="@+id/longitude"/

      TextView android:layout_height="wrap_content"

      android:layout_width="wrap_content"

      android:text="緯度"/

      EditText android:layout_height="fill_parent"

      android:layout_width="100px"

      android:id="@+id/latitude"/

      Button android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:text="查找"

      android:id="@+id/button"/

      /LinearLayout

      com.amap.mapapi.map.MapView android:id="@+id/mapView"

      android:layout_width="fill_parent" android:layout_height="fill_parent"

      android:clickable="true"

      /

      /LinearLayout

      四、最后就是軟件的主程序部分了、里面需要的類和 *** 不多,主要以按鈕的監聽器和地圖的界面實現為主

      Java代碼

      public void onCreate(Bundle savedInstanceState) {

      // this.setMapMode(MAP_MODE_VECTOR);//設置地圖為矢量模式

      super.onCreate(savedInstanceState);

      setContentView(R.layout.main);

      mMapView = (MapView) findViewById(R.id.mapView);

      mMapView.setBuiltInZoomControls(true); // 設置啟用內置的縮放控件

      mMapController = mMapView.getController(); // 得到mMapView

      // 的控制權,可以用它控制和驅動平移和縮放

      point = new GeoPoint((int) (39.982378 * 1E6), (int) (116.304923 * 1E6)); // 用給定的經緯度構造一個GeoPoint,單位是微度(度*

      // 1E6)

      // 按鈕添加監聽器

      button_location = (Button) findViewById(R.id.location);

      longitude = (EditText) findViewById(R.id.longitude);

      latidute = (EditText) findViewById(R.id.latitude);

      locationListener = new OnClickListener() {

      public void onClick(View e) {

      if (e.equals(button_location)) {

      // 得到文本輸入框的中經緯 度坐標值

      String latStr = longitude.getText().toString();

      // 將得到的字符串轉成數值

      double lat = Integer.parseInt(latStr);

      String lngStr = latidute.getText().toString();

      double lng = Integer.parseInt(lngStr);

      //轉成經緯度坐標

      lat=lat*1E6;

      lng=lng*1E6;

      // 用給定的經緯度構造一個GeoPoint,單位是微度(度*1E6)

      point = new GeoPoint((int) (lat), (int) (lng));

      mMapController.setCenter(point); // 設置地圖中心點

      mMapController.setZoom(12); // 設置地圖zoom 級別

      // 添加地圖覆蓋物

      // MyLocationOverlay(this, mMapView);

      mylocTest.enableMyLocation(); // 判斷是否發現位置提供者

      mylocTest.enableCompass(); // 打開指南針

      mMapView.getOverlays().add(mylocTest);// 添加定位覆蓋物

      }

      }

      };

      // 按鈕添加監聽器

      button_location.setOnClickListener(locationListener);

      mMapController.setCenter(point); // 設置地圖中心點

      mMapController.setZoom(12); // 設置地圖zoom 級別

      // 添加地圖覆蓋物

      mylocTest = new MyLocationOverlay(this, mMapView);

      mylocTest.enableMyLocation(); // 判斷是否發現位置提供者

      mylocTest.enableCompass(); // 打開指南針

      mMapView.getOverlays().add(mylocTest);// 添加定位覆蓋物

      }

      //另外一個添加界面覆蓋物的類:

      public class MyLocationOverlayProxy extends com.amap.mapapi.map.MyLocationOverlay{

      private Location mLocation;

      protected final Paint mPaint = new Paint();

      protected final Paint mCirclePaint = new Paint();

      private Bitmap gps_marker=null;

      private Point mMapCoords = new Point();

      private final float gps_marker_CENTER_X;

      private final float gps_marker_CENTER_Y;

      private final LinkedListRunnable mRunOnFirstFix = new LinkedListRunnable();

      public MyLocationOverlayProxy(amap amap, MapView mMapView) {

      super(amap, mMapView);

      gps_marker = ((BitmapDrawable) amap.getResources().getDrawable(

      R.drawable.marker_gpsvalid)).getBitmap();

      gps_marker_CENTER_X = gps_marker.getWidth() / 2 - 0.5f;

      gps_marker_CENTER_Y= gps_marker.getHeight() / 2 - 0.5f;

      }

      public boolean runOnFirstFix(final Runnable runnable) {

      if (mLocation != null) {

      new Thread(runnable).start();

      return true;

      } else {

      mRunOnFirstFix.addLast(runnable);

      return false;

      }

      }

      public void onLocationChanged(Location location) {

      // TODO Auto-generated method stub

      mLocation = location;

      for(final Runnable runnable : mRunOnFirstFix) {

      new Thread(runnable).start();

      }

      mRunOnFirstFix.clear();

      super.onLocationChanged(location);

      }

      protected void drawMyLocation(Canvas canvas, MapView mapView, final Location mLocation,

      GeoPoint point, long time) {

      Projection pj=mapView.getProjection();

      if (mLocation != null) {

      mMapCoords=pj.toPixels(point, null);

      final float radius = pj.metersToEquatorPixels(mLocation.getAccuracy());

      this.mCirclePaint.setAntiAlias(true);

      this.mCirclePaint.setARGB(35, 131, 182, 222);

      this.mCirclePaint.setAlpha(50);

      this.mCirclePaint.setStyle(Style.FILL);

      canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, this.mCirclePaint);

      this.mCirclePaint.setARGB(225, 131, 182, 222);

      this.mCirclePaint.setAlpha(150);

      this.mCirclePaint.setStyle(Style.STROKE);

      canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, this.mCirclePaint);

      canvas.drawBitmap(gps_marker, mMapCoords.x-gps_marker_CENTER_X, mMapCoords.y-gps_marker_CENTER_Y, this.mPaint);

      }

      }

      }

      android開發如何用高德地圖進行模擬定位

      一、 要實現高德地圖定位呢,首先需要做好以下幾步準備: 1 在高德開放平臺注冊帳號 2 在開發中下載Android平臺下的地圖SDK和定位SDK文件 進入相關下載下載自己想要的功能或文件,圖只是截取了地圖SDK的頁面,定位SDK也是一樣,按自己想要的文android開發如何用高德地圖進行模擬定位

      安卓開發高德gis地圖,高德地圖手機app

      android開發 調用高德地圖SDK

      高德地圖使用的是面向接口的框架,其ViewMap類作為核心類,需要重寫Activity生命周期的所有 *** ,這要求開發者具備面向對象多態性,繼承性的功底。如果不理解常用的設計模式和架構,對于該平臺的掌握會稍微吃力。

      在安卓開發中如何在自己設置的經緯度顯示到高德地圖上中心點

      首先創建工程,并在工程Build PathConfigure Build Path…libraries 中選擇“Add Externel JARs…”,選定

      MapApi.jar,點擊OK,這樣就可以將高德地圖Android API 庫文件引入。然后在工程Build PathConfigure Build

      Path…Order and Export 中將引入的庫文件MapApi.jar 選中,點擊OK,這樣您就可以在您的程序中使用高德地圖API

      了。

      二、我們在不熟悉的情況下、先盡量多的添加此軟件應用權限;所以在mainifest中添加如下代碼;插入的位置在

      application的代碼之前。

      Java代碼

      uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/uses-permission

      uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/uses-permission

      uses-permission android:name="android.permission.INTERNET"/uses-permission

      uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/uses-permission

      uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/uses-permission

      uses-permission android:name="android.permission.READ_PHONE_STATE"/uses-permission

      uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/uses-permission

      uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/uses-permission

      三、接著就要在res文件下的layout中添加界面布局了。其代碼如下、你可以完全復制進去。

      Java代碼

      ?xml version="1.0" encoding="utf-8"?

      LinearLayout xmlns:android=""

      android:orientation="vertical"

      android:layout_width="fill_parent"

      android:layout_height="fill_parent"

      !--添加文本輸入框,查找地址--

      LinearLayout

      android:layout_height="wrap_content"

      android:layout_width="wrap_content" android:orientation="horizontal"

      xmlns:android=""

      android:layout_gravity="center_horizontal"

      TextView android:layout_height="wrap_content"

      android:layout_width="wrap_content"

      android:text="經度"/

      EditText android:layout_height="fill_parent"

      android:layout_width="100px"

      android:id="@+id/longitude"/

      TextView android:layout_height="wrap_content"

      android:layout_width="wrap_content"

      android:text="緯度"/

      EditText android:layout_height="fill_parent"

      android:layout_width="100px"

      android:id="@+id/latitude"/

      Button android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:text="查找"

      android:id="@+id/button"/

      /LinearLayout

      com.amap.mapapi.map.MapView android:id="@+id/mapView"

      android:layout_width="fill_parent" android:layout_height="fill_parent"

      android:clickable="true"

      /

      /LinearLayout

      四、最后就是軟件的主程序部分了、里面需要的類和 *** 不多,主要以按鈕的監聽器和地圖的界面實現為主

      Java代碼

      public void onCreate(Bundle savedInstanceState) {

      // this.setMapMode(MAP_MODE_VECTOR);//設置地圖為矢量模式

      super.onCreate(savedInstanceState);

      setContentView(R.layout.main);

      mMapView = (MapView) findViewById(R.id.mapView);

      mMapView.setBuiltInZoomControls(true); // 設置啟用內置的縮放控件

      mMapController = mMapView.getController(); // 得到mMapView

      // 的控制權,可以用它控制和驅動平移和縮放

      point = new GeoPoint((int) (39.982378 * 1E6), (int) (116.304923 * 1E6)); // 用給定的經緯度構造一個GeoPoint,單位是微度(度*

      // 1E6)

      // 按鈕添加監聽器

      button_location = (Button) findViewById(R.id.location);

      longitude = (EditText) findViewById(R.id.longitude);

      latidute = (EditText) findViewById(R.id.latitude);

      locationListener = new OnClickListener() {

      public void onClick(View e) {

      if (e.equals(button_location)) {

      // 得到文本輸入框的中經緯 度坐標值

      String latStr = longitude.getText().toString();

      // 將得到的字符串轉成數值

      double lat = Integer.parseInt(latStr);

      String lngStr = latidute.getText().toString();

      double lng = Integer.parseInt(lngStr);

      //轉成經緯度坐標

      lat=lat*1E6;

      lng=lng*1E6;

      // 用給定的經緯度構造一個GeoPoint,單位是微度(度*1E6)

      point = new GeoPoint((int) (lat), (int) (lng));

      mMapController.setCenter(point); // 設置地圖中心點

      mMapController.setZoom(12); // 設置地圖zoom 級別

      // 添加地圖覆蓋物

      // MyLocationOverlay(this, mMapView);

      mylocTest.enableMyLocation(); // 判斷是否發現位置提供者

      mylocTest.enableCompass(); // 打開指南針

      mMapView.getOverlays().add(mylocTest);// 添加定位覆蓋物

      }

      }

      };

      // 按鈕添加監聽器

      button_location.setOnClickListener(locationListener);

      mMapController.setCenter(point); // 設置地圖中心點

      mMapController.setZoom(12); // 設置地圖zoom 級別

      // 添加地圖覆蓋物

      mylocTest = new MyLocationOverlay(this, mMapView);

      mylocTest.enableMyLocation(); // 判斷是否發現位置提供者

      mylocTest.enableCompass(); // 打開指南針

      mMapView.getOverlays().add(mylocTest);// 添加定位覆蓋物

      }

      //另外一個添加界面覆蓋物的類:

      public class MyLocationOverlayProxy extends com.amap.mapapi.map.MyLocationOverlay{

      private Location mLocation;

      protected final Paint mPaint = new Paint();

      protected final Paint mCirclePaint = new Paint();

      private Bitmap gps_marker=null;

      private Point mMapCoords = new Point();

      private final float gps_marker_CENTER_X;

      private final float gps_marker_CENTER_Y;

      private final LinkedListRunnable mRunOnFirstFix = new LinkedListRunnable();

      public MyLocationOverlayProxy(amap amap, MapView mMapView) {

      super(amap, mMapView);

      gps_marker = ((BitmapDrawable) amap.getResources().getDrawable(

      R.drawable.marker_gpsvalid)).getBitmap();

      gps_marker_CENTER_X = gps_marker.getWidth() / 2 - 0.5f;

      gps_marker_CENTER_Y= gps_marker.getHeight() / 2 - 0.5f;

      }

      public boolean runOnFirstFix(final Runnable runnable) {

      if (mLocation != null) {

      new Thread(runnable).start();

      return true;

      } else {

      mRunOnFirstFix.addLast(runnable);

      return false;

      }

      }

      public void onLocationChanged(Location location) {

      // TODO Auto-generated method stub

      mLocation = location;

      for(final Runnable runnable : mRunOnFirstFix) {

      new Thread(runnable).start();

      }

      mRunOnFirstFix.clear();

      super.onLocationChanged(location);

      }

      protected void drawMyLocation(Canvas canvas, MapView mapView, final Location mLocation,

      GeoPoint point, long time) {

      Projection pj=mapView.getProjection();

      if (mLocation != null) {

      mMapCoords=pj.toPixels(point, null);

      final float radius = pj.metersToEquatorPixels(mLocation.getAccuracy());

      this.mCirclePaint.setAntiAlias(true);

      this.mCirclePaint.setARGB(35, 131, 182, 222);

      this.mCirclePaint.setAlpha(50);

      this.mCirclePaint.setStyle(Style.FILL);

      canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, this.mCirclePaint);

      this.mCirclePaint.setARGB(225, 131, 182, 222);

      this.mCirclePaint.setAlpha(150);

      this.mCirclePaint.setStyle(Style.STROKE);

      canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, this.mCirclePaint);

      canvas.drawBitmap(gps_marker, mMapCoords.x-gps_marker_CENTER_X, mMapCoords.y-gps_marker_CENTER_Y, this.mPaint);

      }

      }

      }

      如果 不清楚啊, 可以到我群里討論 look at my n a m e

      安卓開發高德gis地圖的介紹就聊到這里吧,感謝你花時間閱讀本站內容,更多關于高德地圖手機app、安卓開發高德gis地圖的信息別忘了在本站進行查找喔。

      客服微信號碼

      客服微信號碼

      客服微信號碼

      客服微信號碼

      留言咨詢
      提交留言

      您將免費獲得

      • 全面診斷

        您將獲得專家對您公司申請資質所需條件的全面診斷服務,我們不同于傳統代辦公司,僅是提供一些通用的,淺顯的建議

      • 找出疏忽點

        我們在了解您公司的基本情況之后,將挖掘出您公司目前不利于資質申請的疏忽點,還將詳細說明您在申請資質時應當改善的確切的事項。

      • 分析需求

        我們通過豐富的從業經驗,結合目前的實際情況,確認好符合您實際經營情況的資質需求。

      • 定制方案與報價

        對您的需求深入了解后,將結合您公司目前的情況,我們將為您量身定制一份資質代辦方案及報價單。

      獲取方案

      ×
      請設置您的cookie偏好
      歡迎來到資質參謀
      我們希望在本網站上使用cookie,以便保障本網站的安全、高效運轉及服務優化,有關我們使用cookie的更多信息,請點擊查看了解更多。
      接收Cookies
      決絕Cookies
      亚洲激情黄色小说| 亚洲免费福利视频| 亚洲熟女综合色一区二区三区 | 亚洲AV中文无码乱人伦下载| AV在线亚洲男人的天堂| 亚洲欧洲精品成人久久奇米网 | 亚洲av丰满熟妇在线播放| 亚洲精品字幕在线观看| 亚洲精品二区国产综合野狼| 亚洲自偷自偷图片| 亚洲开心婷婷中文字幕| 日本亚洲欧洲免费天堂午夜看片女人员| 国产乱辈通伦影片在线播放亚洲| 亚洲中文字幕成人在线| 毛茸茸bbw亚洲人| 亚洲中文字幕久久精品无码喷水 | 久久久久亚洲av成人无码电影 | 亚洲国产精品yw在线观看| 亚洲福利电影一区二区?| 亚洲精品成人久久| 久久精品国产亚洲AV忘忧草18| 亚洲人成电影网站| 狠狠色香婷婷久久亚洲精品| 中文字幕亚洲综合久久综合| 亚洲欧美日韩一区二区三区 | 国产亚洲精彩视频| 春暖花开亚洲性无区一区二区| 亚洲AV无码一区二区三区久久精品| 亚洲成a∨人片在无码2023 | 男人的天堂亚洲一区二区三区 | 亚洲精品美女久久久久9999| 亚洲的天堂av无码| 亚洲精品一二三区| 亚洲av无码无线在线观看| 亚洲VA综合VA国产产VA中| 久久久久亚洲av成人无码电影 | 亚洲精品第一国产综合亚AV| 精品国产_亚洲人成在线| 亚洲精品麻豆av| 国产亚洲综合色就色| 亚洲高清无在码在线电影不卡|