0
如何將數據綁定到kotlin中的imageview?Android Kotlin ImageView綁定
<ImageView
app:photoFilePath="@{item.photoFilePath}"
android:layout_width="60dp"
android:layout_height="60dp"
/>
這是我的課我已經實現了:
class OrderInfoFragment : BaseDialogFragment() {
private lateinit var mOrderItem: OrderItem
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val inflater = activity.layoutInflater
val binding = DataBindingUtil.inflate<FragmentOrderInfoBinding>(
inflater, R.layout.fragment_order_info, null, false)
val view = binding.root
binding.item = mOrderItem
}
@BindingAdapter("bind:photoFilePath")
fun loadPhotoFilePath(imageView: ImageView, path: String) {
}
}
我在同伴對象使用loadPhotoFilePath
嘗試。