I want to create an android layout from which I want to create multiple copies. I understand that declaring a layout in XML will create one instance. Is there a way to use the XML View declaration as a "definition" rather than a "declaration"? Or can I clone a show?
thank
What do you mean by an instance of multiple instances? In the same activity? Or in different events?
You can inflate the layout using LayoutInflater . This will allow you to create multiple instances of the view in the same action.
, , ListView, .
XML-, , , . http://developer.android.com/resources/articles/layout-tricks-reuse.html
, xml, LayoutInflater, .
, .
, inflate (int resource, ViewGroup root) LayoutInflater. null .
However, you should keep in mind that LayoutInflator is quite expensive and should be used as little as possible.
Source: https://habr.com/ru/post/1763920/More articles:Inheritance and foreign key constraints using postgresql? - inheritanceКак заставить PostgreSQL/pgAdmin вести себя лучше с учетом чувствительности к регистру? - postgresqlHow to bind pushButton to a widget? - c ++how to check if data is under control or not while form POST in asp.net - c #Perl Date Comparison with MySQL - mysqlChanging a matlab function in a loop - matlabForm Builder with jQuery validation - javascriptCan I use the Facebook API to retrieve images from my profile? - javascriptBasic data binding examples - javascriptHow to read pdf fields using Java? - javaAll Articles