0
AndroidこのコードはHelloOverlayItemクラスで行われます(2つの場所を入力して行を追加します)。問題は、私は、このメソッドを入れたときに何のオーバーレイ項目がちょうどパスを表示されませんし、私はそれを削除すると、オーバーレイ項目は彼女があなたはスーパードロー()メソッドをオーバーライドしてきた方法アンドロイドオーバーレイ項目を持つパスメソッド
enter code here
public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow)
{
GeoPoint p = new GeoPoint((int) (29.98703241482666 * 1E6), (int) (31.439915891647359 * 1E6));
GeoPoint p2=new GeoPoint((int) (29.987107515335083 * 1E6), (int) (31.43912136554718 * 1E6));
//GeoPoint p3 = new GeoPoint((int) (29.98703241482666 * 1E6), (int) (31.439915891647359 * 1E6));
//GeoPoint p4=new GeoPoint((int) (29.987107515335083 * 1E6), (int) (31.43912136554718 * 1E6));
// Let's assume you've assigned values to these two GeoPoints now.
Projection projection = mapView.getProjection();
Point startingPoint = projection.toPixels(p, null);
Point endingPoint = projection.toPixels(p2, null);
//point startingPoint1 = projection.toPixels(p3, null);
//Point endingPoint2 = projection.toPixels(p4, null);
// Create the path containing the line between the two points.
Path path = new Path();
path.moveTo(startingPoint.x, startingPoint.y);
path.lineTo(endingPoint.x, endingPoint.y);
// Setup the paint. You'd probably do this outside of the draw() method to be more efficient.
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.RED);
// mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
// mPaint.setStrokeJoin(Paint.Join.ROUND);
//mPaint.setStrokeCap(Paint.Cap.ROUND);
//mPaint.setStrokeWidth(2);
// Can set other paint characteristics, such as width, anti-alias, color, etc....
// Draw the path!
canvas.drawPath(path, paint);
}
よろしくお願い致します! – anji