How do you inflate a view and add it to a the list of child views of a LinearLayout
?
When you call the inflater constructor, set attachToRoot
to false; then manually add the view after you've initialized it. Otherwise, you'll lose your initialization for all but the first child added.
Example:
View view = inflater.inflate(R.layout.some_view, parent, false);
((TextView) view.findViewById(R.id.some_text)).setText(someString);
parent.addView(view);
An example of what not to do:
View view = inflater.inflate(R.layout.some_view, parent);
((TextView) view.findViewById(R.id.some_text)).setText(someString);