随笔 - 262  文章 - 0  评论 - 5  阅读 - 20万

android data binding jetpack VI 清理一些概念。BR 运算表达式

android data binding jetpack VIII BindingConversion

android data binding jetpack VII @BindingAdapter

android data binding jetpack V 实现recyclerview 绑定

android data binding jetpack IV 绑定一个方法另一种写法和参数传递

android data binding jetpack III 绑定一个方法

android data binding jetpack II 动态数据更新

android data binding jetpack I 环境配置 model-view 简单绑定

 

 

清理一些概念。

上一篇里遇到的BR类。

BR跟android R相似。

这个类是自动生成,记了所有在xml中定义的变量。

一个变量会生成一个set方法。比如:

这里两个方法是等效的。

 BR 类自动生成,要编译一下才能引用。不然后提示错误。跟之前的ActivityMainBinding类一个道理。

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

   绑定过程可用表达式。

  支持的表达式:

  1. Mathematical + - / * %
  2. String concatenation +
  3. Logical && ||
  4. Binary & | ^
  5. Unary + - ! ~
  6. Shift >> >>> <<
  7. Comparison == > < >= <=
  8. instanceof
  9. Grouping ()
  10. Literals - character, String, numeric, null
  11. Cast
  12. Method calls
  13. Field access
  14. Array access []
  15. Ternary operator ?:

 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

当类名有冲突时,其中一个类名可以重命名为: alias

<import type="android.view.View"/>
<import type="com.example.real.estate.View" alias="OtherView"/>

 

posted on   wp7ers  阅读(969)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示