Home > Mobile >  [question] about databinding view of how to realize dynamically created data binding
[question] about databinding view of how to realize dynamically created data binding

Time:11-22

After recently started learning android development, introduction to Java, familiar with the AS development environment, begin to build your first program, procedure is simple, basic implementation is AS follows:
1, dynamically create several view, such as Textview1, Textview2, Textview3, button (no) in the dynamic no ID, XML

2, generates a Arraylist , use the Viewdatabinding create binding (check a lot of information, is essentially the XML binding, haven't seen directly in the program to realize dynamically created and binding, and I just want to challenge, to implement dynamic create the view of binding, this is a problem)

Check a lot of information in the process of thinking, the more the more disorderly, contact a lot of concepts, such as observables, annotations reflection, layoutmanager, adapter, recycleview, these seemingly can realize this function, the problem is as follows:

Just use viewdatabinding how to realize dynamically created controls binding? Assuming that XML structure as follows

.
(some through the parent id, addview created the view)
.




CodePudding user response:

Have a plug-in SAO years
Dynamic binding of XML is gradle a Java file generated at compile time

CodePudding user response:

I know, but I just want to learn the databinding, watched so many now, also knew the databinding is how to return a responsibility, it can understand so, compiling before the program execution, and dynamic databinding surface, the actual compiled XML is static, then the runtime dynamically created in the compiled program these view is impossible to enter binding, because activitydatabinding. Java has been generated, the binding is done,
  • Related