我需要弄清楚如何用图像更改默认的“我的位置”蓝点,它的作用也与指向行进方向的指南针相同。这可以通过设备指南针或通过从 GPS 检测行进方向来计算
我做了一些谷歌搜索,但到目前为止只找到了在 iPhone 上更改点的方法的参考,我正在使用 Android ......
我很感激这方面的一些支持和指导
亲切的问候
缺口
在 OnCreate 中:
LocationManager locman = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locman.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 2, locationListener);
//Adds a current location overlay to the map 'mapView' and turns on the map's compass
MyLocation myLocationOverlay = new MyLocation(this, mapView);
mapView.getOverlays().add(myLocationOverlay);
myLocationOverlay.enableMyLocation();
myLocationOverlay.enableCompass();
mapView.getOverlays().add(myLocationOverlay);
mapView.postInvalidate();
In OnLocationChanged:
dbllatitude = locFromGps.getLatitude();
dbllongitude = locFromGps.getLongitude();
dblaltitude = locFromGps.getAltitude();
bearing = locFromGps.getBearing();
strlatitude = Double.toString(dbllatitude);
strlongitude = Double.toString(dbllongitude);
dblaltitude = (dblaltitude / 0.3048);
LocationText.setText("Your Location: Latitude " + dbllatitude + " Longitude: " +dbllongitude + " Altitude " + dblaltitude);
boolean hasbearing = locFromGps.hasBearing();
if (hasbearing = false) {
Toast.makeText(getApplicationContext(), "No bearing", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getApplicationContext(), "I HAZ bearing: " + bearing, Toast.LENGTH_SHORT).show();
}
MyLocation.mOrientation = bearing;