新人求助 关于高德地图系统蓝点不显示的问题

qq_36169079 2018-03-24 06:28:20
我参考了网上其他人的demo敲了一个地图demo,可以进行地位但是定位后不显示系统蓝点,可是在onLocationChanged()明明设置了系统小蓝点啊,网上找了都没有出现这个问题解决办法的,麻烦大家帮忙看看问题在哪

private void init() {
if (aMap == null) {
aMap = mapView.getMap();
mUiSettings = aMap.getUiSettings();
//显示比例尺
mUiSettings.setScaleControlsEnabled(true);

aMap.setLocationSource(this);// 设置定位监听
aMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
aMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
}

}

public void onLocationChanged(AMapLocation amapLocation) {
if (mListener != null && amapLocation != null) {
if (amapLocation != null
&& amapLocation.getErrorCode() == 0) {

mListener.onLocationChanged(amapLocation);// 显示系统小蓝点

//新的定位点
newLatLng = new LatLng(amapLocation.getLatitude(),amapLocation.getLongitude());
//绘制新的轨迹
if (lastLatLng != null){
aMap.addPolyline(new PolylineOptions().color(Color.rgb(0, 153, 255))
.add(lastLatLng,newLatLng));
}
lastLatLng = newLatLng;//记录为旧记录点


} else {
String errText = "定位失败," + amapLocation.getErrorCode()+ ": " + amapLocation.getErrorInfo();
Log.e("AmapErr", errText);

}
}
}

...全文
608 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧