如何显示一张大图的地图?
How to show a map which is a big image?
我得到一张 5000x5000 的 png 图片。这张图片是某种地图。我想在图像视图中显示图像,这给了我一个 outOfMemoryException(当然)。所以我尝试设置一个 sampleSize,但这降低了分辨率,使地图不是很有用。
所以基本上我想显示此图像并且能够缩放和滚动而不会丢失分辨率。什么是最好的方法?
我是Dave Morrissey's SubsamplingScaleImageView
的粉丝,好像涵盖了你想要的。引用项目文档,是:
A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) without OutOfMemoryErrors. Includes pinch to zoom, panning, rotation and animation support, and allows easy extension so you can add your own overlays and touch event detection.
我得到一张 5000x5000 的 png 图片。这张图片是某种地图。我想在图像视图中显示图像,这给了我一个 outOfMemoryException(当然)。所以我尝试设置一个 sampleSize,但这降低了分辨率,使地图不是很有用。
所以基本上我想显示此图像并且能够缩放和滚动而不会丢失分辨率。什么是最好的方法?
我是Dave Morrissey's SubsamplingScaleImageView
的粉丝,好像涵盖了你想要的。引用项目文档,是:
A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) without OutOfMemoryErrors. Includes pinch to zoom, panning, rotation and animation support, and allows easy extension so you can add your own overlays and touch event detection.