小编nos*_*a13的帖子

使用Universal Image Loader的FileNotFoundException

这个问题是关于这个流行的Android库,Android的通用图像加载器:https://github.com/nostra13/Android-Universal-Image-Loader

  1. 我确定添加了WRITE_EXTERNAL_STORAGE.
  2. 我启用了内存和磁盘缓存
  3. 我使用UnlimitedDiscCache进行磁盘缓存
  4. 我正在构建Android 2.2 SDK.当我在Android 4.1.2 Nexus S设备上测试应用程序时,会发现例外情况.
  5. 对于我的大多数图像,加载是平滑和精细的.但是,对于某些图像,我总是得到相同的例外.以下是一个例子.

图片网址:http://i10.topit.me/l046/10046137034b1c0db0.jpg

回溯:

01-14 00:24:42.125: 

ERROR/ImageLoader(1671): http://i10.topit.me/l046/10046137034b1c0db0.jpg

java.io.FileNotFoundException: http://i10.topit.me/l046/10046137034b1c0db0.jpg

at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)

at com.nostra13.universalimageloader.core.download.URLConnectionImageDownloader.getStreamFromNetwork(URLConnectionImageDownloader.java:40)

at com.nostra13.universalimageloader.core.download.ImageDownloader.getStream(ImageDownloader.java:27)

at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.saveImageOnDisc(LoadAndDisplayImageTask.java:296)

at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:204)

at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:128)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
Run Code Online (Sandbox Code Playgroud)

请帮忙.

java android universal-image-loader

7
推荐指数
1
解决办法
7528
查看次数

ImageViewZoom中不显示图像

我想在ImagePagerActivity中使用ImageViewZoomUniversal Image Loader.

那么,我做了什么:

  1. 我将imageviewtouch.jar添加到项目类路径中.
  2. 在ImagePagerActivity中,我在instantiateItem()函数中更改了一行.我评论了ImageView的位置,并将其替换为ImageViewTouch(4.和5.行)

    @Override
    public Object instantiateItem(View view, int position) {
        final View imageLayout = inflater.inflate(R.layout.item_pager_image, null);
        //final ImageView imageView = (ImageView) imageLayout.findViewById(R.id.image);
        final ImageViewTouch imageView = (ImageViewTouch) imageLayout.findViewById(R.id.image);
    
        final ProgressBar spinner = (ProgressBar) imageLayout.findViewById(R.id.loading);
        final TextView textView = (TextView)imageLayout.findViewById(R.id.text);
    
        imageLoader.displayImage(images[position], imageView, options, new ImageLoadingListener() {
    
    
            public void onLoadingStarted() {
                spinner.setVisibility(View.VISIBLE);
            }
    
    
            public void onLoadingFailed(FailReason failReason) {
                String message = null;
                switch (failReason) {
                    case IO_ERROR:
                        message = "Input/Output error";
                        break;
                    case OUT_OF_MEMORY: …
    Run Code Online (Sandbox Code Playgroud)

android android-viewpager universal-image-loader

5
推荐指数
1
解决办法
1903
查看次数

如何获取ImageView的maxWidth和maxHeight参数?

我在xml声明了ImageView:

...
<ImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:maxHeight="60dip"
    android:maxWidth="60dip"
    android:scaleType="centerCrop" />
 ...
Run Code Online (Sandbox Code Playgroud)

我想以编程方式获取maxWidthmaxHeight参数值:

...
ImageView imageView = (ImageView) findViewById(R.id.image);
int maxWidth = ?
int maxHeight = ?
...
Run Code Online (Sandbox Code Playgroud)

我该怎么做?

css java android imageview

4
推荐指数
1
解决办法
4809
查看次数