android - 调试android数据绑定(bind)?

标签 android android-databinding

谁能告诉我如何调试或找到数据绑定(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/

相关文章:

Android smoothScrollTo 不调用 onScrollStateChanged

android - 将 Twitter Fabric REST API 解析为 JSON 字符串

android - Kotlin DataBinding : IncompleteAnnotationException: android. databinding.BindingBuildInfo 缺少元素

Android 数据绑定(bind)错误。找不到访问器

android - 空 Android 数据绑定(bind)

android - ObservableField 不传播更改

生成的数据绑定(bind)文件中的 Android 数据绑定(bind) : cannot find . ..BindingImpl

android - 再次在 Activity 生命周期 : onStart is called when it shouldn't be

android - 找不到Android支持库

android - Retrofit2:未找到 HTTP 404