下面卡住的imageview databindig是我的coustom适配器和Imageview。我指的是这里的[ 找不到带有参数的属性的设置方法,但是没有解决方案可以帮助任何人。
@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}"
/>
Run Code Online (Sandbox Code Playgroud)