DataBindingUtil.setContentView - Type parameter T has incompatible upper bounds

前端 未结 9 973
逝去的感伤
逝去的感伤 2021-02-02 06:54

\"Android Studio\" shows error message \"Type parameter T has incompatible upper bounds: ViewDataBinding and ActivityChecklistsBinding.

ActivityChecklistsBindin         


        
9条回答
  •  眼角桃花
    2021-02-02 07:22

    The binding activity is automatically generated and takes the name from the layout file, not the activity class.

    So if you have an activity named BeautifulActivity and the corresponding layout named sweet_layout.xml, then the generated name will be SweetLayoutBinding and not BeautifulActivityBinding.

    Don't make my same mistake by confusing between MainActivity and activity_main.xml

提交回复
热议问题