为什么我在使用arr.sort()
时无法解决此方法,但我无法解决Glide
:
.diskstaretegy()
我的朋友: -
Glide.with(getActivity())
.load(chalet.profilePhoto)
.asBitmap() <--- cannot resolve this
.diskCacheStrategy(DiskCacheStrategy.ALL) <--- cannot reslove this
.fitCenter()
.placeholder(R.drawable.logo).dontAnimate().into(mImageView);
答案 0 :(得分:26)
我找到了解决问题的方法,您必须在asBitmap()
之后添加with()
,它就像过去一样。
PS:我的滑音版是4.7.1
答案 1 :(得分:18)
对于asBitmap,您需要按如下方式编写它:
static string ConnectionInfo = "server=192.168.1.114;" +
"database=Data;"+
"username=jackilion;"+
"password=*****";
答案 2 :(得分:8)
<?php
ini_set("display_errors",1);
error_reporting(E_ALL);
//code goes here
?>
答案 3 :(得分:5)
如果遇到错误,请按照以下步骤操作。
在Glide库中,将.asBitmap()
移到.load()
之前
--------------------- OR ----------------------- >
Glide.with(context)
.setDefaultRequestOptions(requestOptions)
.asBitmap()
.load(url)
.into(holder.imageView);
答案 4 :(得分:3)
你可以用其他方式设置
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(R.drawable.ic_placeholder);
requestOptions.diskCacheStrategy(DiskCacheStrategy.ALL)
requestOptions.error(R.drawable.ic_error);
Glide.with(context)
.setDefaultRequestOptions(requestOptions)
.asBitmap()
.load(url).into(holder.imageView);
答案 5 :(得分:2)
在asBitmap()
之前致电load()
Glide.with(context)
.asBitmap()
.load(uri)
答案 6 :(得分:1)
https://bumptech.github.io/glide/doc/migrating.html#requestoptions
Glide.with(getActivity()).asBitmap()
.load(headerURl)
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Bitmap> target, boolean b) {
// Toast.makeText(cxt,getResources().getString(R.string.unexpected_error_occurred_try_again),Toast.LENGTH_SHORT).show();
return false;
}
@Override
public boolean onResourceReady(Bitmap bitmap, Object o, Target<Bitmap> target, DataSource dataSource, boolean b) {
if (null == header)
return false;
//set image
header.setImageBitmap(bitmap);
//process bitmap
Palette.from(bitmap).generate(
new Palette.PaletteAsyncListener() {
@SuppressWarnings("ResourceType")
@Override
public void onGenerated(Palette palette) {
int vibrantColor = palette
.getVibrantColor(R.color.primary_500);
int vibrantDarkColor = palette
.getDarkVibrantColor(R.color.primary_700);
collapsingToolbarLayout
.setContentScrimColor(vibrantColor);
collapsingToolbarLayout
.setStatusBarScrimColor(vibrantDarkColor);
}
});
return false;
}
}
).submit();