Android Binding

联合创作 · 2023-09-25 05:48

Android Binding 提供了一个通用的框架用来实现 Android 的视图部件跟数据模型进行绑定的功能,用来实现 Android 应用程序的 MVC 模式。

Android-Binding is a MVVM (Model-View-ViewModel) framework, that helps freeing the Activity from working directly to User Interfaces. As an Activity, it's job is only to supply the ViewModel that the View requires to render the result while ViewModel is a class that with zero direct coupling with the View (and actually you might supply a different View to it).

关键特性:

  • Declare view binding in Layout XML files. No additional files needed.
  • Helps implements MVVM
  • Much easier for Unit-Testing
  • Model Validation that validates against ViewModel
  • Support Cursor results, and you can even validate the cursor result!
浏览 6
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报