Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glide 4.3.1 override and placeholder features not work

I update my glide to 4.3.1 but all over I use glide the feature .override() and .placeholder() get error: cannot find symbol method.

Glide.with(this)
            .load(imageUrl)
            .override(200, 200)
            .placeholder(R.drawable.ic_avatar_sign_up)
            .into(ivAvatar);

How can I fix this?

like image 684
Mohammad Hadi Avatar asked Nov 13 '17 10:11

Mohammad Hadi


People also ask

What is Glide override?

Image Resizing with override(x, y) Glide automatically limits the size of the image it holds in cache and memory to the ImageView dimensions.

What is placeholder Glide Android?

Placeholders are Drawables that are shown while a request is in progress.


Video Answer


2 Answers

You should use RequestOptions

Includes methods like:

  • centerCrop()
  • placeholder()
  • error()
  • priority()
  • diskCacheStrategy()
  • priority()
  • override(100, 100)
  • transforms()

Sample code

Glide.with(this)
     .load(YOUR_URL)
     .apply(new RequestOptions().override(100, 100).placeholder(R.drawable.placeHolder).error(R.drawable.error_pic))
     .into(imageview);
like image 193
Goku Avatar answered Oct 19 '22 03:10

Goku


Try This

Glide.with(this)
     .load(imageUrl)
     .apply(new RequestOptions().placeholder(R.drawable.ic_launcher).override(200, 200))
     .into(ivAvatar);
like image 27
Ratilal Chopda Avatar answered Oct 19 '22 04:10

Ratilal Chopda