3
在我的應用我想顯示地圖指針,我想指針上方顯示一個按鈕文本視圖。使用該按鈕我想要移動到下一個活動。以下是我的代碼來展示這一點,但是如何在文本和按鈕右側顯示一個點。而如何寫BTN行動吧Android的地圖與一個TextView在點一個按鈕
class MapOverlay extends com.google.android.maps.Overlay
{
public boolean draw(Canvas canvas, MapView mapView,boolean shadow, long when)
{
super.draw(canvas, mapView, shadow);
//---translate the GeoPoint to screen pixels---
Point screenPts = new Point();
mapView.getProjection().toPixels(p, screenPts);
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.marker);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-100, null);
mapView.getProjection().toPixels(q, screenPts);
@SuppressWarnings("unused")
Bitmap bmp1 = BitmapFactory.decodeResource(getResources(), R.drawable.blue);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-100, null);
return true;
}
}
p = new GeoPoint((int) (latPt * 1E6),(int) (lngPt * 1E6));
Log.e("point p ",""+p);
mapController.animateTo(p);
mapController.setZoom(16);
mapView.invalidate();
mapView.setTraffic(true);
mapController = mapView.getController();
MapOverlay mapOverlay = new MapOverlay();
List<Overlay> listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);