Glide 没有解析它的方法 [英] Glide does not resolve its method

查看:28
本文介绍了Glide 没有解析它的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我尝试在我的 android 应用程序中使用 Glide 图像加载器,同时使用它我遇到了无法解决问题的方法.

Today I'm trying to use Glide image loader in my android application while using this I had facing method not resolving problem.

Glide
     .with(this)
     .load(R.drawable.image_default_profile_picture)
     .into(mUserImage);

这段代码工作得很好.但是当我尝试这个

This code working pretty fine. But when I'm trying this

Glide
     .with(this)
     .load(R.drawable.image_default_profile_picture)
     .placeholder(R.mipmap.ic_launcher)
     .fitCenter()
     .into(mUserImage);

那么这句话不能解析方法fitCenter()placeholder.我缺少什么?

Then this saying cannot resolve method fitCenter(), placeholder. What I am missing?

推荐答案

似乎更新的库有问题.添加 .apply(new RequestOptions() 以继续使用最新版本.

Seems like updated library has any issue. Add .apply(new RequestOptions() to continue with latest version.

代码

Glide
 .with(this)
 .load(R.drawable.image_default_profile_picture)
 .apply(new RequestOptions()
 .placeholder(R.mipmap.ic_launcher)
 .fitCenter())
 .into(mUserImage);

这篇关于Glide 没有解析它的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆