canvas教程

图像与边框在地图叠加使用android

字号+ 作者:H5之家 来源:H5之家 2017-05-28 16:00 我要评论( )

图像与边框在地图叠加使用android(Image with border in map overlay using android) - IT屋-程序员软件开发技术分享社区

问 题

I show this link but answer was just only display the balloon.

Picture with a border as a map overlay

But I am finding just like the display images with border.... Like this.

If any one have any idea about how to do this so please help me.

I am done display the 3-5 images in map. But now I just want to display that images with border.

Thanks in advance.

解决方案

here is some code that draws a circle:

private class ProximityOverlay extends Overlay { public void draw(Canvas canvas, MapView mapview, boolean b) { // draw some stuff in here, like Paint paint = new Paint(); paint.setAntiAlias(true); paint.setStrokeWidth(2.0f); double latitude = location.getLatitude(); double longitude = location.getLongitude(); Projection projection = mapView.getProjection(); GeoPoint leftGeo = new GeoPoint((int) (latitude * 1e6), (int) (longitude * 1e6)); Point left = new Point(); projection.toPixels(leftGeo, left); paint.setColor(Color.parseColor("#00CCFF")); paint.setStyle(Style.FILL); canvas.drawCircle(left.x, left.y, 9, paint); paint.setColor(Color.parseColor("#003399")); paint.setStyle(Style.STROKE); canvas.drawCircle(left.x, left.y, 10, paint); }

you can modify it to draw a black rectangle:

canvas.drawRect(left, top, right, bottom, paint);

本文地址:IT屋 » Image with border in map overlay using android

问 题

我显示此链接,但答案只是显示气球。



具有边框的图片作为地图叠加层



但是我发现就像显示图像与边框....像这样。



如果有人有任何关于如何做到这一点的想法请帮助我。



我已经在地图上显示了3-5张图片。但是现在我只想用边框显示图像。



提前感谢


解决方案

这里是一些代码绘制一个圆圈:



私有类ProximityOverlay扩展覆盖{

public void draw(Canvas canvas,MapView mapview,boolean b){
//在这里绘制一些东西,如
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setStrokeWidth(2.0f);
double latitude = location.getLatitude();
double longitude = location.getLongitude();
投影投影= mapView.getProjection();
GeoPoint leftGeo = new GeoPoint((int)(纬度* 1e6),
(int)(longitude * 1e6));
左点= new Point();
projection.toPixels(leftGeo,left);

paint.setColor(Color.parseColor(“#00CCFF”));
paint.setStyle(Style.FILL);
canvas.drawCircle(left.x,left.y,9,paint);
paint.setColor(Color.parseColor(“#003399”));
paint.setStyle(Style.STROKE);
canvas.drawCircle(left.x,left.y,10,paint);



}


您可以修改它绘制一个黑色矩形:



canvas.drawRect(left,top,right,bottom,paint);

本文地址:IT屋 » 图像与边框在地图叠加使用android

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • android绘图canvas的sava、restore、rotate以及若干问题,canvas

    android绘图canvas的sava、restore、rotate以及若干问题,canvas

    2017-05-26 18:06

  • Android的动态壁纸视差滚动效果

    Android的动态壁纸视差滚动效果

    2017-05-26 17:03

  • Android Canvas练习(3)自已绘柱形图(Bar Chart)

    Android Canvas练习(3)自已绘柱形图(Bar Chart)

    2017-05-26 11:00

  • Android 绘图基础:Canvas画布——自定义View基础(绘制表盘、矩形、圆形、

    Android 绘图基础:Canvas画布——自定义View基础(绘制表盘、矩形、

    2017-05-26 10:08

网友点评