那里!我正在使用 glide 在我的应用程序中加载图像。以前我使用 Picasso 并且它工作但在迁移到 Glide (v4.7.1) 之后我无法使用监听器来获取资源的状态。我在下面附上了代码,请帮助我解决这个问题。
Glide.with(SlideImageActivity.this)
.load(Constant.arrayList.get(position)
.getImage())
.apply(new RequestOptions()
.placeholder(R.color.colorPrimary)
.dontAnimate().skipMemoryCache(true))
.listener(new RequestListener<String, DrawableResource>() {
public boolean onException(Exception e, String model, Target<DrawableResource> target, boolean isFirstResource) {
spinner.setVisibility(View.GONE);
return false;
}
public boolean onResourceReady(DrawableResource resource, String model, Target<DrawableResource> target, boolean isFromMemoryCache, boolean isFirstResource) {
spinner.setVisibility(View.GONE);
return false;
}
})
.into((ImageView) imageLayout.findViewById(R.id.image));
错误行显示在此下方
new RequestListener<String, DrawableResource>()
如果我尝试使用此构建 apk,则会显示以下错误
错误:类型参数的数量错误;需要 1
IDE 显示如下
从 RequestListener 派生的类匿名类必须声明抽象或实现方法。
如果我实现了 IDE 推荐我的方法,我会得到关注
错误:类型参数的数量错误;需要 1
30秒到达战场
相关分类