简体   繁体   English

有关使用图形的高级建议(带有图标,平移和缩放支持的地图)

[英]High level advice for working with Graphics (A map with Icons, Pan & Zoom support)

I'm new to Android and Java. 我是Android和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. 是否存在可以自动处理所有这些的控件,还是我需要使用画布并实现所有这些msyelf的控件?

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. 如果确实很大,那么也许您应该看看其中一些标准的地图绘制API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM