Reputation: 2743
I wonder what would be the difference between setting "stockTableLayout" which is TableLayout as a root of "inflated element"
View newStockRow = inflater.inflate(R.layout.stock_qoute_row, stockTableLayout);
And then modify newStockRow.
VS
View newStockRow = inflater.inflate(R.layout.stock_qoute_row, null);
modify then newStockRow
and then add it via addView
stockTableLayout.addView(newStockRow);
Upvotes: 2
Views: 2536
Reputation: 2743
Thanks to @Luksprog
This method in LayoutInflater class:
public View inflate (int resource, ViewGroup root)
Returns
The root View of the inflated hierarchy. If root was supplied, this is the root View; otherwise it is the root of the inflated XML file.
So first way really returns stockTableLayout. Not new Row that I wanted to insert.
But second return the root element of newly created layout from R.layout.stock_qoute_row reference
Upvotes: 2