【问题标题】:displaying a custom map and placing pin/images on the map显示自定义地图并在地图上放置图钉/图像
【发布时间】:2013-12-10 09:40:17
【问题描述】:

我想为杂货店创建一个目录应用程序。我已经有了这个地方的平面图。我只是想在视图中显示它,我想在上面放一些标记/图钉/图像..我不知道从哪里开始。有人告诉我使用位图和画布,但我不知道如何使用它,因为 google 中的其他教程非常模糊且难以理解..

我的应用需要什么:

  • 显示来自图像源的自定义地图
  • 让我可以在上面放置标记、图钉和一些图片

【问题讨论】:

    标签: java android xml map


    【解决方案1】:

    一个简单的方法是使用ImageView:

    //从你的 floorPlanImage 制作位图,从文件中获取示例 Bitmap floorPlanImage = BitmapFactory.decodeFile(filePath, options); //制作一个可变位图,所以它可以改变 Bitmap mutableFloorPlanImage = floorPlanImage.copy(Bitmap.Config.ARGB_8888, true); //创建一个画布来绘制你的 floorPlanImage Canvas mCanvas = new Canvas(mutableFloorPlanImage); //在 floorPlanImage 上绘制一个标记或另一个图像,你可以使用 left 和 top //坐标来定位它,在这个例子中都是 0 mCanvas.drawBitmap(markerBitmap, 0, 0, null); //在ImageView中显示生成的位图 imageView.setImageBitmap(mutableFloorPlanImage);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-04
      • 1970-01-01
      相关资源
      最近更新 更多