安卓开发高德gis地图,高德地图手机app

2024-05-05 GIS 51
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