使用图形的高级建议(带有图标、平移和缩放支持的地图)
我是 Android 和 Java 新手。我希望能够使用图像作为背景,让我们假设它是一张地图。然后我想在地图顶部的特定坐标处覆盖图标(其他图形),并且我想知道用户何时单击这些图标,以便我可以在它们旁边渲染文本。我也想要潘&缩放支持。
是否有一个控件可以自动处理所有这些,或者我是否需要使用画布并实现所有这些东西 msyelf.
I'm new to Android and Java. I want to be able to use an image as a background, let's pretend it's a map. Then I want to overlay icons (other graphics) on top of the map at specific coordinates and I want to know when the user clicks on these icons, so I can render text next to them. I also want pan & zoom support.
Is there a control that can handle all this automatically or do I need to be working with a canvas and implementing all this stuff msyelf.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于你的地图有多大。假设您的地图不太大,您可以只使用画布。您要做的就是将地图传输到背景,然后在其上绘制图标。如果您的地图稍大一些,您可能需要将其切成块,然后进行一些范围搜索以仅获取可见的块和图标。如果它真的很大,那么也许您应该查看一些标准的地图绘制 API。
It depends on how big your map is. Assuming that your map is not too big you could just use a canvas. All you would do just blit your map to the background, then draw your icons over it. If your map is a bit larger, you may have to chop it up into chunks, then do some range searching to get only the chunks and icons which are visible. If it is really big, then maybe you should look some of the standard map drawing APIs out there.