Android - DataBinding - How and when the Binding classes will be generated?

后端 未结 18 1740
小蘑菇
小蘑菇 2021-02-03 16:51

DataBinding Guide States

  By default, a Binding class will be generated based on the name of the layout 
file, converting it to Pascal case and suffixing “Bindi         


        
18条回答
  •  迷失自我
    2021-02-03 17:16

    What is your layout name?

    The above layout file was activity_main.xml so the generate class was ActivityMainBinding.

    What this means is that the generated class name will depend on your layout's name

    activity_main.xml -> ActivityMainBinding.java

    I think your activity name is "main_activity", so the generated binding class name should be MainActivityBinding not ActivityMainBinding

提交回复
热议问题