【发布时间】:2019-06-07 16:45:46
【问题描述】:
下面卡住的 imageview databindig 是我的自定义适配器和 Imageview。我参考了这个 [https://stackoverflow.com/questions/40188894/cannot-find-the-setter-for-attribute-with-parameter] 但没有得到解决方案 - 有人可以帮忙吗?谢谢。
@BindingAdapter("app:image_url")
fun loadImage(view: ImageView, logoUrl: String?) {
if (logoUrl == null) {
view.setImageResource(R.drawable.alert_dark_frame)
} else {
Picasso.with(view.getContext())
.load(logoUrl)
.placeholder(R.mipmap.sym_def_app_icon)
.into(view)
}
}
<data>
<import type="android.view.View" />
<variable name="abc"
type="com.example.viewmodel.Result"/>
</data>
<ImageView
android:id="@+id/circleImageView"
android:layout_width="100dp"
android:layout_height="100dp"
app:image_url="@{abc.picture.thumbnail}"
/>
【问题讨论】:
-
如果您从绑定适配器中删除
app:是否有效? -
是的,我试过但没有用
标签: android data-binding kotlin