Android Repeater

Is there any type of repeater functions in android? I have a relative layout (inside the line in the list) and inside that I would like the TextView series to appear one after the other (as if they were child lines in the list line). The problem is that the number of these "child lines" will be different. is there any way to do this, or should I just create TextView objects in the code and programmatically add them to a linear or tabular layout?

+5
source share
2 answers

The closest thing (besides ListView / ListAdapter, of course) that I can think of is ViewSwitcher and ViewSwitcher.ViewFactory , but there is nothing magical there: it is an interface that you can call to get a view.

Since this is only one line to get a view and add it to your current hierarchy anyway, although ( View.inflate(context, R.layout.somelayout, myContainerViewGroup)) it seems silly to go with something heavier, but if you would be better off wrapping something like Factory, check AOSP source for ViewSwitcher .

+1
source

- TextViews . , StringBuilder, "\n" , .

0

All Articles