android - Create duplicates of already attached view -


I am currently trying to increase a layout which eventually adds a vertical linearLayout container as a larger part Am dynamic form creation module

Layout_checkbox.exml is below:

  Android: TextView  & Lt; LinearLayout Android: id = "@ + id / checkboxGroup" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" android: orientation = "vertical" & gt; & Lt; Checkbox Android: id = "@ + ID / Checkbox" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" Android: text = "sample" /> & Lt; / LinearLayout & gt;   

What I want to do now is to capture the checkbox ( @ + id / checkbox ) and make copies all of these linear Lateout @ + id / checkboxGroup .

  layout = (linear timer) under inflater.inflate (R.layout.layout_checkbox, container, false); LinearLayout checkbox group = (linear layout) layout.findViewById (R.id.checkboxGroup); Checkbox checkbox = (checkbox) checkbox group.findvibid (rs checkbox); // code is assumed that the clone / duplicate checkbox   

I know that I can easily increase the checkbox from another XML definition so that many examples can be drawn, then Join the group. The reason for this is that I am trying to do it this way because I am making some kind of library, and I am trying to implement some kind of conference because it is easy to use.

Edit:

This has worked, but it easily smells of performance:

  layout = (linear layout) inflater .inflate (R.LateLightout_checkbox, container, false); Linear Line Basic Checkbox Group = (Linear Layout) Layout.FindvibIID (RID Checkbox Group); (String entryItem: entry.fieldEntries) {LinearLayout tempCheckboxLayout = (LinearLayout) inflater.inflate (R.layout.layout_checkbox, container, incorrect); LinearLayout checkbox group = (linear line) tempCheckboxLayout.findViewById (R.id.checkboxGroup); Checkbox checkbox = (checkbox) checkbox group.findvibid (rs checkbox); Checkbox.setText (entryItem); CheckboxGroup.removeView (checkbox); OriginalCheckboxGroup.addView (checkbox); }    

  What I want to do if possible is the checkbox (@ + ID / checkbox) and copy it   

No, you can not think of duplication / clone because you'll always have the same context as the context and a change will all change, if you change the same view , Each time a view is the only way to be blown.

Edit:

There is no way to clone / duplicate the checkboxes, but each time you want to use the checkbox, Flowering linear layout) And use the inflated checkbox After you do this, you are going to use / clone a checkbox.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -