android: data binding error: cannot find symbol class

后端 未结 26 3074
生来不讨喜
生来不讨喜 2020-12-14 05:49

I am getting started for using DataBinding feature. I am facing problem with it.

Error:(21, 9) error: cannot find symbol class ContactL

26条回答
  •  醉话见心
    2020-12-14 06:03

    You must change your activity_contact_list to be binded - add layout tag as you did in content_contact_list. Don't forget, The root layout inside activity_contact_list must have an id for the Binding class to be generated and will be named ActivityContactListBinding (i.e. the name of the layout with camel casting instead of underscores).

    Next, inside activity_contact_list, give an id, then you will have access for its binding instance through your ActivityContactListBinding instance.

    Somthing like:

    binding.contentContactList.setContact(user);
    

    Let me know if it works.

提交回复
热议问题