如何瓷砖和滚动Android的一个大的图像(10000x10000) [英] How to tile and scroll a large image (10000x10000) in android

查看:137
本文介绍了如何瓷砖和滚动Android的一个大的图像(10000x10000)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在Android的地图项目。它含有较大的10000x10000分辨率的图像。使用这种图像位图它给的OutOfMemoryError 。所以我想瓷砖和滚动这一形象。当我滚动的图像,唯一可见的屏幕必须有瓷砖等无形的瓷砖必须回收。我花了很多时间,但没有发现任何东西。

I am working in a map project in android. It contains larger image of 10000x10000 resolution. Using this image with Bitmap it gives OutOfMemoryError. So I want to tile and scroll this image. When I scroll image, only visible screen must have tiles and other invisible tiles must be recycled. I spent lots of time but didn't find anything.

任何帮助将AP preciated。 为我提供更好的解决方案或想法。

Any help will be appreciated. Provide me better solutions or idea.

推荐答案

按照戴夫的建议,您可以将图像分割成1600份250x250px每个。 Photoshop中做到这一点很容易在不到一分钟(这里)。你不必担心编写HTML自己太。一旦你的HTML(可以称之为bigimage.html)和图像文件夹,请将这两个在你的资产的文件夹,并访问他们乐此不疲 -

as per Dave's recommendation, you can split the image into 1600 parts of 250x250px each. Photoshop does this easily in less than a minute (here). You don't have to worry about writing the html yourself too. Once you have the html (lets call it bigimage.html) and the images folder, place both these in your assets folder and access them this way -

    setContentView(webView);
    try {
        webView.loadUrl("file:///android_asset/bigimage.html";
        webView.getSettings().setLoadsImagesAutomatically(true);
    } catch (Exception e) {
        e.printStackTrace();
    }

这篇关于如何瓷砖和滚动Android的一个大的图像(10000x10000)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆