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
One minute with the doctor, the postures are cons...
Fan-shot stills of the drama "Ning An Ru Men...
[[163670]] Laying the foundation In order to prep...
Top of Thailand Land, a new global choice. Recent...
The subway is very busy this year and is often po...
Growth hackers are the real source of revenue for...
In May 2022, the Ministry of Finance issued a noti...
How much does it cost to make an educational prom...
Meizu is a domestically produced mobile phone tar...
I have recently read a lot of articles related to...
With the continuous popularization of China's...
When operating seed users , the operation will ha...
It is estimated that many people do not know much...
With the widespread coverage of 4G networks and w...
[[396720]] Since Ant Group's IPO was suspende...