Setup
Before using data binding, you must enable the plugin in your build.gradle
.
android {
....
dataBinding {
enabled = true
}
}
Note: Data binding was added to the Android Gradle plugin in version 1.5.0
Binding class names
The data binding plugin generates a binding class name by converting your layout's file name to Pascal case and adding "Binding" to the end. Thus item_detail_activity.xml
will generate a class named ItemDetailActivityBinding
.
Resources