问题
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?
回答1:
you can ALT + Enter
on your view root then convert into databinding layout
.
回答2:
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.
回答3:
You should customize templates and put it into the <Android Studio Installation path>\plugins\android\lib\templates
folder.
来源:https://stackoverflow.com/questions/44888602/databinding-templates-for-android-studio