I want to dynamically add some views to a LinearLayout
that is already defined in XML.
I'm able to add views to the screen but they are not being placed 'inside' the right LinearLayout
.
How can I get a reference to this specific Layout from code, similar to getting a View
by using findViewById()
?
Better Version: To add another layout in activity/Fragment
Happy Coding(-:
This should work:
As Marcarse pointed out you can do
The LinearLayout class extends ViewGroup which itself extends the View class. This makes acquiring a reference to a layout as easy as getting a reference to another View.