0

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()**
ColdFire
  • 6,764
  • 6
  • 35
  • 51
demo
  • 672
  • 3
  • 9
  • 34

2 Answers2

2

// 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);
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
1

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.

Somesh Kumar
  • 8,088
  • 4
  • 33
  • 49