适配器中无法识别 Kotlin 扩展
Kotlin extension not recognized in adapter
我有毕加索的基本扩展工具:
public val Context.picasso: Picasso
get() = Picasso.with(this)
public fun ImageView.load(path: String, request: (RequestCreator) -> RequestCreator) {
request(context.picasso.load(path)).into(this)
}
当我尝试从适配器中的图像视图上下文调用它时,它无法被识别。
与 itemView.context.picasso
相同
谢谢!
我很确定您的扩展超出了范围(在不同的包中)。
像这样导入你的扩展:
import your.package.picasso
import your.package.load
查看 the docs 了解更多信息。
我有毕加索的基本扩展工具:
public val Context.picasso: Picasso
get() = Picasso.with(this)
public fun ImageView.load(path: String, request: (RequestCreator) -> RequestCreator) {
request(context.picasso.load(path)).into(this)
}
当我尝试从适配器中的图像视图上下文调用它时,它无法被识别。
与 itemView.context.picasso
相同谢谢!
我很确定您的扩展超出了范围(在不同的包中)。 像这样导入你的扩展:
import your.package.picasso
import your.package.load
查看 the docs 了解更多信息。