如何在 Kotlin 中使用 Fresco?

问题描述 投票:0回答:1

我正在尝试在 Kotlin 中显示一个图像弹出窗口,为此我正在创建一个对话框并使用 fresco 库从 url 设置图像,但我收到语法错误,我应该如何执行此操作,下面是我的实现。 我也想设置 onClick 事件该怎么做。

android kotlin kotlin-android-extensions fresco facebook-fresco
1个回答
1
投票

尝试这个,因为您在设置视图之前设置图像,并尝试使用 picaso 和 Glide 来获取带有 url 的图像

val view = inflater.inflate(R.layout.dialog_streak_homepopup, container, false)
val image = view.findViewById(R.id.streak_popup) as SimpleDraweeView
val uri: Uri = Uri.parse("https://raw.githubusercontent.com/facebook/fresco/master/docs/static/logo.png")
image.setImageURI(uri)
return View
© www.soinside.com 2019 - 2024. All rights reserved.