I've decided to use DataBinding library for my Android project. Are there any plugins/code templates available to install into Android Studio to get new Activity / Fragment etc added using Android Studio's wizard auto generated code compatible with DataBinding? I need to create models/presenters/variables in xml every time, can I get them to be generated automatically?
you can ALT + Enter
on your view root then convert into databinding layout
.
Go to build.gradle of your module and enter
android {
...
buildFeatures {
dataBinding true
}
}
and then ALT + Enter on your view root and select convert into databinding layout .
Well,it's not fully what am I looking for, but this looks promising: https://plugins.jetbrains.com/plugin/9271-databinding-support - int theory, it should able to convert standard layouts to data binding:
It basically intended to add all mising DataBinding integration to Android Studio. Shame Google is still not going to add any databinding integration to Android Studio and we need 3rd party plugins for that.
You should customize templates and put it into the <Android Studio Installation path>\plugins\android\lib\templates
folder.
Android Studio Shortcut:
Step 1: place a cursor at view root (means top most view).
Step 2:
For Window:
Alt + Enter
For MacOs :
Option + Enter
Step 3: Select convert into databinding layout
Step 4: Clean and rebuild
© 2022 - 2024 — McMap. All rights reserved.