DataBinding笔记3

自定义加载方法
加载图片

 



@BindingAdapter("showImage")
fun showIcon(imageView: ImageView?, url:String?){
    imageView?.let {
        Glide.with(it.context).load(url).into(it)
    }
}

bindingBinding.imageUrl="https://t9.baidu.com/it/u=3363001160,1163944807&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg?sec=1597330077&t=80ebf64999d887b8722547a7b033a1ef"

你可能感兴趣的:(DataBinding笔记3)