【发布时间】:2018-05-24 23:45:44
【问题描述】:
我在 DropBox 的共享文件夹中有一张图片。我已将 Universal Image Loader 加载到我的应用程序中,我正在尝试从共享文件夹中提取图像并将其显示在图像视图中。一切似乎都在工作,除了显示图像时,我得到的只是一个白屏。
String fileURL = "https://www.dropbox.com/s/(obfuscated)/stripad.jpg";
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
ImageView imageview = (ImageView)findViewById(R.id.adtest1);
DisplayImageOptions options = new DisplayImageOptions.Builder()
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.cacheInMemory(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
imageLoader.displayImage(fileURL, imageview, options);
我的 XML 是这样的:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DropBoxTest">
<ImageView
android:id="@+id/adtest1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
</RelativeLayout>
我不知道出了什么问题。我没有收到任何错误,并且 LogCat 是空的。我已经尝试过 .PNG 和 .JPG 图像,两种类型的行为都相同。我可以在浏览器中手动导航到 fileURL 并毫无问题地查看图像。
【问题讨论】:
标签: android universal-image-loader