I realize the potential for android data binding for MVVM is great and it opens doors. But regarding performance, is data binding faster then using findViewById in native android ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It looks to me that it is faster per the docs:
Views With IDs
A public final field will be generated for each View with an ID in the layout. The binding does a single pass on the View hierarchy, extracting the Views with IDs. This mechanism can be faster than calling findViewById for several Views.
So it seems data binding only has to do a single pass over the view hierarchy instead of us always calling findViewById.