我正在使用Picasso将大小约为250-500 KB(1600x~1200)的JPG文件从Url加载到ImageView中。
Picasso.with(getApplicationContext())
.load(stringURL)
.placeholder(R.drawable.holder).error(R.drawable.holder)
.into(image)
我的ImageView:
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:layout_marginTop="0dip"
android:adjustViewBounds="true"
android:cropToPadding="false"
android:scaleType="fitCenter"
问题在于图片的首次加载非常慢(大约20秒),CPU消耗高,因此内存分配也很大。 例如,LogCat显示“Grow heap (frag case) to 56.789 for 7601812-byte allocation”仅针对单个图像。
这是否与图像缓存有关?有没有一种方法可以禁用缓存并直接将原始图像下载到ImageView中?
从iPhone中的双子应用程序下载相同的图像是瞬间完成的...
fit()
或resize()
,或者在最后使用你的RGB_565
配置。 - dnkoutso