- databinding –> Imageview
Pit background:
Use RecyclerView to make a list of nine grids, using Imageview display icon.
Error message:
D:\f_data\work\git\mpro_java\app\build\generated\ap_generated_sources\debug\out\com.cc.test\DataBinderMapperImpl.java:19 : : � � � � � Ҳ � � � � � � � the import com. Cc. Test. Databinding. ListItemCommonlyServerBindingImpl; : ^ � � � � � � ListItemCommonlyServerBindingImpl lambda � � : � � � � � com. Hnty. Mpro. DatabindingCopy the code
Solution:
Add the following code to the Adapter
@BindingAdapter({"app:imgUrl"})
public static void getTransImageView(ImageView imageView, int res) {
imageView.setImageResource(res);
}
Copy the code
ImgUrl =”@{model.icon_id}”