Glide.with(context).load(“file://”+bitmapList.get(position)) showing error?

元气小坏坏 提交于 2019-12-13 05:05:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!