问题
Suppose I have a custom setter method where I need two arguments:
@BindingAdapter({"imageUrl", "placeholder"})
public static void loadImage(ImageView imageView, String imageUrl, Drawable drawable) {
Picasso.with(imageView.getContext()).load(imageUrl).placeholder(drawable).into(imageView);
}
What would the corresponding xml look like?
回答1:
Looks like it can be done like this:
<ImageView app:imageUrl=“@{data.imageUrl}”
app:placeholder=“@{@drawable/placeholder}”/>
see http://developer.android.com/intl/es/tools/data-binding/guide.html
来源:https://stackoverflow.com/questions/36921406/how-can-i-pass-multiple-arguments-via-xml-for-a-custom-setter-when-using-android