16
我的工作在Android应用程序,我在这个完全newbe显示地图。所以我想知道如何在地图以及如何显示标记改变特定的时间他的位置定义一样在后台线程或任何将发送经纬度值,并标记上如何在android系统与标记
我的工作在Android应用程序,我在这个完全newbe显示地图。所以我想知道如何在地图以及如何显示标记改变特定的时间他的位置定义一样在后台线程或任何将发送经纬度值,并标记上如何在android系统与标记
是移动如果你打算只显示一个单一的项目,MapView.addView()
后来更新位置setLayoutParams
的伎俩。
private ImageView mCurrentPointer;
@Override
public void onLocationChanged(Location l) {
int latitude = (int) (l.getLatitude() * 1e6);
int longitude = (int) (l.getLongitude() * 1e6);
// Prepare new LayoutParams object that centers on our new latitude/longitude
MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT,
MapView.LayoutParams.WRAP_CONTENT, new GeoPoint(latitude, longitude),
MapView.LayoutParams.CENTER);
if (mCurrentPointer == null) {
// If "current location" pin is null, we haven't added it
// to MapView yet. So instantiate it and add it to MapView:
mCurrentPointer = new ImageView(this);
mCurrentPointer.setImageResource(R.drawable.ic_maps_indicator_current_position);
mMapView.addView(mCurrentPointer, lp);
} else {
// If it's already added, just update its location
mCurrentPointer.setLayoutParams(lp);
}
}
感谢您的建议 – Pratik 2011-05-27 06:16:24