谁能告诉我如何调试或找到数据绑定(bind)生成的代码。来自 this链接 我发现它生成了所需的代码。
最佳答案
我猜您正在寻找自动生成的绑定(bind) java 文件。
我也在找他们。最后我在这条路上找到了他们:
/app/build/intermediates/classes/debug/{你的包}/databinding/ActivityMainBinding.java
即 /app/build/intermediates/classes/debug/com/example/databindingdtest/databinding/ActivityMainBinding.java
请注意,这个自动生成的 java 文件是根据 Google's guide 以您的布局名称命名的。 :
Custom Binding Class Names
By default, a Binding class is generated based on the name of the layout file, starting it with upper-case, removing underscores ( _ ) and capitalizing the following letter and then suffixing “Binding”. This class will be placed in a databinding package under the module package. For example, the layout file contact_item.xml will generate ContactItemBinding. If the module package is com.example.my.app, then it will be placed in com.example.my.app.databinding.
希望这对你有帮助:-)
关于android - 调试android数据绑定(bind)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34176948/