2

I have a vector image. If I want to set the image to ImageView, the picture is not loaded.

code:

Glide.with(this).load(R.drawable.vector_image).into(imageView)

However, when I use:

imageView.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.vector_image)) 

and it is working.

Any ideas?

Sam Judd
  • 7,317
  • 1
  • 38
  • 38
Stepan
  • 1,041
  • 5
  • 23
  • 35

3 Answers3

3

Glide doesn't support vector drawables yet. So implementing vector drawables you have to do yourself. For reference you can check below links for this issue reported by developers on github:

link 1
link 2

Akash Jain
  • 437
  • 2
  • 13
1

You can use like this.

Glide.with(this)
    .load("")
    .placeholder(R.drawable.vector_image)
    .into(imageView);

EDIT

You can also use it like this as mentioned on issue

Glide.with(mContext) .load("") .error(R.drawable.vector_image) .into(imageView);
Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60
  • This wont work either, Glide does not support Vector drawable. – Enzokie Sep 30 '16 at 11:02
  • yes . i just found an issue at https://github.com/bumptech/glide/issues/794 . According to this you can use something like this Glide.with(mContext) .load("") .error(R.drawable.vector_image) .into(imageView); – Rahul Khurana Sep 30 '16 at 11:04
0

Try this this working fine.

Glide.with(GlideActivity.this).load(R.drawable.ic_launcher)
                    .fitCenter().into(imageview);
Sachin Suthar
  • 692
  • 10
  • 28