gpt4 book ai didi

android - 自定义 map 图 block 模糊

转载 作者:行者123 更新时间:2023-11-29 20:05:00 24 4
gpt4 key购买 nike

在某些缩放级别下, map 图 block 是模糊的并且没有进行平滑渲染。

使用以下代码:

public MapTileLayer setupTileLayer(final TileListener listener) {
TileProvider provider = new TileProvider() {
@Override
public Tile getTile(int x, int y, int zoom) {
String filename = listener.loadTileFilename(x, y, zoom, true);
if (filename != null && filename.trim().length() > 0) {
byte[] bytes = FileService.getBytesForFile(filename);
if (bytes != null) {
return new Tile(TILE_SIZE, TILE_SIZE, bytes);
}
}
return null;
}
};
TileOverlayOptions options = new TileOverlayOptions().tileProvider(provider);
options.visible(true);

return new GoogleTileLayer(map.addTileOverlay(options));
}

最佳答案

也许问题所在的图像会有所帮助,但无论如何您都应该注 Intent block 的大小。在大多数设备上,图 block 的大小(或 gmaps 如何平铺世界)是 256x256 像素,但在密度更高的设备上(我使用过 Nexus 10),图 block 的大小是 512x512。这意味着如果您拥有/下载一个 256 的图 block 并以 512 显示它会降低质量。看这里: https://developers.google.com/maps/documentation/android-api/tileoverlay#coordinates

When creating images for a tile layer, you will need to create an image for each tile at each zoom level that you wish to support. Google Maps targets 256 dp (device-independent pixels) when displaying tiles. For high resolution devices, it is recommended that you return high dpi tiles (512x512 px). Refer to the Android Developers documentation for information on supporting different screen sizes and densities.

如果您使用的是 URLTileProvider,您可以在构造函数中提供大小,如果您使用的是自定义创建的图 block ,则应该创建 2 个版本的图 block (用于正常/高密度),或者简单地创建高密度并让系统对普通设备进行降尺度。

如果不是这个问题,请附上您的问题的图片!

关于android - 自定义 map 图 block 模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35805630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com