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
Popular Science Times reporter Chen Jie On the on...
The World Cup craze has just passed, and problems...
The eight golden rules introduced in this article...
H5 has become a common form of content for event ...
"I'm in the United States, just got off ...
The China Earthquake Networks Center officially d...
These two days, Everyone was shocked by a breakin...
Mini programs have been popular for several years...
Current status of fatty liver disease in my count...
Have you ever encountered such a situation? ——Aft...
In an advertising company, you will always encoun...
Breast milk is the most ideal natural food for ba...
There is a variety show that inserts advertisemen...
Marketing status: The advertiser is a local O2O d...