问题
I using below code
Glide.with(context)
.load("file://"+bitmapList.get(position))
.override(153,160)
.crossFade()
.centerCrop()
.dontAnimate()
.skipMemoryCache(true)
.into(holder.thumbnail);
problem is that here .override(153,160) this line showing compile error like cannot resolve method override(int,int)
I got solution here: glide:4.3.1 override and placeholder features not work tried manyways it not working..please anyone help me
when i change like this
Glide.with(context)
.load("file://"+bitmapList.get(position))
.apply(new RequestOptions().override(153,160))
.crossFade()
.centerCrop()
.dontAnimate()
.skipMemoryCache(true)
.into(holder.thumbnail);
// I am getting error this line **.crossFade()**
回答1:
// I am getting error this line .crossFade()
Cross fades
Unlike Glide v3
does NOT apply a cross fade or any other transition by default to requests. Transitions
must be applied manually.
To apply a cross fade transition to a particular load, you can use:
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
Glide.with(this)
.load("https://i.stack.imgur.com/7CChZ.jpg?s=328&g=1")
.transition(withCrossFade())
.apply(new RequestOptions().override(100, 100)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_background).centerCrop()
)
.into(imageView);
回答2:
The correct implementation for crossFade in glide V4 should be:
Glide.with(this)
.load(YOUR_URL)
.transition(withCrossFade())
.apply(new RequestOptions().override(153,160).placeholder(R.drawable.placeHolder).error(R.drawable.error_pic))
.into(imageview);
Use this one.
来源:https://stackoverflow.com/questions/50174277/glide-withcontext-loadfile-bitmaplist-getposition-showing-error