Git Product home page Git Product logo

largeimage's Issues

关闭硬件加速就显示了

加载大图,关闭硬件加速就可以了!今天我尝试加载688x5360的图片,而Bitmap 最大能显示4096x4096的。而我关闭硬件加速就显示了。。。。。

OOM

一张图放大缩小这样到处滚动,大图也会OOM

allowBackup 是否必要

你好,library项目里的 mainfest 里的 allowBackup=true 与 我们的项目产生冲突,请问这个是否可以去除

Image failed to decode using JPEG decoder

09-20 15:55:41.808 14992-15304/W/System.err: java.io.IOException: Image failed to decode using JPEG decoder
09-20 15:55:41.808 14992-15304/W/System.err: at android.graphics.BitmapRegionDecoder.nativeNewInstance(Native Method)
09-20 15:55:41.808 14992-15304/ W/System.err: at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:124)
09-20 15:55:41.808 14992-15304/ W/System.err: at com.shizhefei.view.largeimage.factory.InputStreamBitmapDecoderFactory.made(InputStreamBitmapDecoderFactory.java:22)
09-20 15:55:41.808 14992-15304/ W/System.err: at com.shizhefei.view.largeimage.BlockImageLoader$LoadImageInfoTask.doInBackground(BlockImageLoader.java:793)
09-20 15:55:41.808 14992-15304/ W/System.err: at com.shizhefei.view.largeimage.TaskQueue$Task.doInBackground(TaskQueue.java:44)
09-20 15:55:41.808 14992-15304/ W/System.err: at com.shizhefei.view.largeimage.TaskQueue$Task.doInBackground(TaskQueue.java:31)
09-20 15:55:41.808 14992-15304/W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:292)
09-20 15:55:41.808 14992-15304/ W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-20 15:55:41.808 14992-15304/W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-20 15:55:41.808 14992-15304/ W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-20 15:55:41.808 14992-15304/ W/System.err: at java.lang.Thread.run(Thread.java:818)

请问为什么小图片显示不出来?

大图显示效果很不错,但是几百kb的小图片反而显示不了,问什么呢?

我看到了ReadMe有如下内容:
//加载普通大小图片
largeImageView.setImage(R.drawable.cat);
largeImageView.setImage(drawable);
largeImageView.setImage(bitmap);

怎么判断图片是大图还是普通大小?

定位到区域块

你好,我这边需要第一次加载大图,然后中心区域显示大图的某一块,要怎么处理,我这边能先知道left,top, right,bottom

滑动冲突

和Recyclerview,PagerSnapHelper,结合起来做左右滑动,显示大图,有滑动冲突,怎么解决,求

设置合适的缩放大小应该能够显示全部图片到 view 中

修改如下,当layout的宽大于高的时候,测试没有问题,使用largeImageView.setScale(largeImageView.getFitScale());
设置图片缩放比例时,能够将图片完整显示

设置 0.9 的原因是:如果不设置,则会感觉图片占得太满,0.9 看起来刚刚好

    private void initFitImageScale(int imageWidth, int imageHeight) {
        final int layoutWidth = getMeasuredWidth();
        final int layoutHeight = getMeasuredHeight();
        if (imageWidth < imageHeight) {
            fitScale = 0.9f * imageWidth / imageHeight * layoutHeight / layoutWidth;
        } else {
            fitScale = 0.9f;
        }
        minScale = 0.25f;
        maxScale = 1.0f * imageWidth / layoutWidth;
        float a = (0.9f * imageWidth / layoutWidth) * layoutHeight / imageHeight;
        float density = getContext().getResources().getDisplayMetrics().density;
        maxScale = maxScale * density;
        if (maxScale < 4) {
            maxScale = 4;
        }
        if (minScale > a) {
            minScale = a;
        }
        if (criticalScaleValueHook != null) {
            minScale = criticalScaleValueHook.getMinScale(this, imageWidth, imageHeight, minScale);
            maxScale = criticalScaleValueHook.getMaxScale(this, imageWidth, imageHeight, maxScale);
        }
    }

大图加载的时候滑动不流畅

  1. 放大之后滑动图片,不能够流畅地滑动
  2. 缩小图片,会导致图片在屏幕内不见
  3. 如果要实现新浪里面的从中心位置开始缩放,应该要怎么实现呢(大图缩放的时候没有滚动条,想要滚动条出现应该怎么办呢)

缩放

长图怎样实现缩放呢?求解。而且,缩放过程没有缩放动画,看起来很僵硬

图片无法解码

03-08 10:43:05.672 809-1142/com.huanmedia.yourchum.debug D/ONE SDK: [2017/3/8 10:43:5:679]: [net] has wifi connection
03-08 10:43:05.672 809-14006/com.huanmedia.yourchum.debug W/System.err:     at android.graphics.BitmapRegionDecoder.nativeNewInstance(Native Method)
03-08 10:43:05.672 809-14006/com.huanmedia.yourchum.debug W/System.err:     at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:124)
03-08 10:43:05.682 809-14006/com.huanmedia.yourchum.debug W/System.err:     at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:150)
03-08 10:43:05.682 809-14006/com.huanmedia.yourchum.debug W/System.err:     at com.shizhefei.view.largeimage.factory.FileBitmapDecoderFactory.made(FileBitmapDecoderFactory.java:23)
03-08 10:43:05.682 809-14006/com.huanmedia.yourchum.debug W/System.err:     at com.shizhefei.view.largeimage.BlockImageLoader$LoadHandler.handleMessage(BlockImageLoader.java:805)
03-08 10:43:05.692 809-14006/com.huanmedia.yourchum.debug W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
03-08 10:43:05.692 809-14006/com.huanmedia.yourchum.debug W/System.err:     at android.os.Looper.loop(Looper.java:136)
03-08 10:43:05.692 809-14006/com.huanmedia.yourchum.debug W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:61)

OOM问题

ViewPager+fragment配合这个控件做的一个图片浏览效果
前面10几个可能内存还能接受,后面滑动到了20几个的时候就开始OOM异常了。
请教优化方案。谢谢

请教实现图片循环展示

@LuckyJayce 看到更新了,最近一直在研究这个库,有注释清晰了许多,感谢。

最近项目需求:滑动时将图片进行循环展示,如下示意图所示。
shiyitu

我想在这个库的基础上进行扩展,目前的做法是在ScrollView中添加两个LargeImageView,基本能实现出效果,但是总感觉不是最优解。而且后续还有添加图片覆盖物等各种需求,感觉这个方式不太好处理。

另一个想法是在getDrawData中进行处理,将x轴方向超出图片边界的部分,用图片头部或尾部进行补充,可是一直没实现出来。

而且如果用这种方式的话,如果一直向一个方向滑动,Scale的fromX是会一直增加或一直减少的,如何重置状态也没有想出好的办法。

请问@LuckyJayce能否指点一二,万分感谢。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.