1. Basic structure 1.1 JavaBeans Objects
1.2 Layout File
1.3 Activity
The above three steps complete the basic data binding 2. Dynamic Updates When the data of the JavaBean object changes, the View is automatically updated. Normal data sources can only be bound. If you want to update dynamically, you must use Observable to store data. The following are three ways to implement Observable. 2.1 Observable Object Implement android.databinding.Observable or inherit its implementation class
2.2 Observable Fields Basic data types have corresponding Observable classes public final ObservableField<String> firstName = new ObservableField<>(); 2.3 Observable Collections ObservableArrayMap<String, Object> mapUser = new ObservableArrayMap<>(); user.put("firstName", "Google"); 2.4 References Whether it is an object, field or collection, data is stored in the form of Observable. The next step is to reference it in the layout.
3. RecyclerView dynamic binding
|
<<: Interview experience: WeChat, NetEase Games, Jinshan Xishanju, Renren
>>: Looking for Easter eggs in the code, Google is no longer the Google you know
The only authorized Chinese version of the popula...
The sales of seafood products such as sea cucumbe...
[[155337]] Although Microsoft's Windows Phone...
Nowadays, Baidu's own products are ranking hi...
Course Catalog 1The effective bottom-fishing meth...
Cai Sen Technology Class Video-Sencai Technology ...
Before I start sharing how to build a traffic cir...
Image source: Tuchong Creative What are these bla...
(April 19, 2017, Shanghai) At the 17th Shanghai I...
We often say that operating short videos requires ...
Nuclear power plants are places where nuclear ene...
The 618 promotion has developed into a major node...
The so-called memory optimization means that in t...
For those who are new to bidding, they often fall...