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
Layout name is in snake_case
, and generated binding class name will be PascalCase
.
If you layout name is
activity_home.xml
then binding class name will beActivityHomeBinding.class
.
When you don't get import suggestion. Import manually your binding class like this. (IDE often does not show suggestions for binding classes)
import databinding.ActivityMainBinding;
Note that I recommend close and open from recent because it takes less time than Rebuild / Restart IDE.
If you still have issues. Let me know in comments, or see this answer for better understanding.