我正在创建具有多个视图的recyclerview。这些视图之一有一个图像,我正在通过Glide加载它们。
我使用的语法是这样:
Glide.with(adapterContext).load(menuItemArrayList.get(i).getMenuItemImage()).placeholder(R.drawable.menu_card_default).into(((DishViewHolder) holder).tvMenuItemDescription);
其中:
-adapterContext是上下文
-menuItemArrayList.get(i).getMenuItemImage()是将其放入数组后得到的图像URL
-(DishViewHolder)持有人).tvMenuItemDescription是我要将图像放入其中的地方
但是,当我尝试编译时,出现以下错误消息:
error: no suitable method found for into(TextView)
method RequestBuilder.<Y#1>into(Y#1) is not applicable
(inferred type does not conform to upper bound(s)
inferred: TextView
upper bound(s): Target<Drawable>)
method RequestBuilder.<Y#2>into(Y#2,RequestListener<Drawable>,Executor) is not applicable
(cannot infer type-variable(s) Y#2
(actual and formal argument lists differ in length))
method RequestBuilder.<Y#3>into(Y#3,RequestListener<Drawable>,BaseRequestOptions<?>,Executor) is not applicable
(cannot infer type-variable(s) Y#3
(actual and formal argument lists differ in length))
method RequestBuilder.into(ImageView) is not applicable
(argument mismatch; TextView cannot be converted to ImageView)
where Y#1,Y#2,TranscodeType,Y#3 are type-variables:
Y#1 extends Target<Drawable> declared in method <Y#1>into(Y#1)
Y#2 extends Target<Drawable> declared in method <Y#2>into(Y#2,RequestListener<TranscodeType>,Executor)
TranscodeType extends Object declared in class RequestBuilder
Y#3 extends Target<Drawable> declared in method <Y#3>into(Y#3,RequestListener<TranscodeType>,BaseRequestOptions<?>,Executor)
我非常肯定这与(DishViewHolder)持有人有关。)tvMenuItemDescription,但我不知道如何应用。