很多人都发现android的浏览器显示大分辨图片会出现显示模糊的问题,我测试是超过100万像素(1024x1024)的图片就会出现模糊。在android的讨论网站上也有对这个问题的一个issue(http://code.google.com/p/android/issues/detail?id=6021)。很明显这是android的浏览器实现代码在加载图片的时候做了限制。相关代码在 external/webkit/WebCore/platform/graphics/android/ImageSourceAndroid.cpp,这个文件中有一个局部函数computeMaxBitmapSizeForCache(),看一下这个函数前面的注释:

    Images larger than this should be subsampled. Using ashmem, the decoded
    pixels will be purged as needed, so this value can be pretty large. Making
    it too small hurts image quality (e.g. abc.com background). 2Meg works for
    the sites I've tested, but if we hit important sites that need more, we
    should try increasing it and see if it has negative impact on performance
    (i.e. we end up thrashing because we need to keep decoding images that have
    been purged.
 
    Perhaps this value should be some fraction of the available RAM...

    已经说得很明白了,可以修改这个函数里面的常数(2*1024*1024),不过修改这个值以后记得改一下上面的一个宏定义MIN_RLE_ALLOC_SIZE为同样的值,否则在加载大图片时可能会很慢。

更多相关文章

  1. Android分发机制
  2. android点击按钮控制图片切换-kotlin
  3. android 触摸手指动作放大和缩小图片
  4. Android(安卓)调用系统相册选择图片并显示
  5. android自带图片资源
  6. Android(安卓)图形密码
  7. Android如何从服务器获取图片
  8. Android知识点
  9. android 网络访问-图片处理优秀开源项目

随机推荐

  1. MySQL主从同步原理介绍
  2. 小时候怎么让我生活会
  3. 详细讲解Docker虚拟化
  4. 实例演示函数参数与返回值、演示模板字面
  5. 移动端布局思路与视口之间关系并实例演示
  6. 仿淘宝移动端首页商品列表
  7. 如何入门学手绘插画?学习手绘插画技巧!
  8. 企业外贸推广常见误区:亲身经验分享
  9. Python库AutoTS一行代码得到最强时序基线
  10. 【Android】抽屉控件 SlidingDrawer 的简