Reputation: 3868
I have a linear layout, defined using xml.
I would like to reuse it. Thus, I need to load it in the code.
I have found getResoruces().getLayout(R.layout.my_layout)
but it returns an XmlResourceParser
object.
How can I convert it into a Linear Layout, please?
Upvotes: 0
Views: 56
Reputation: 4691
Give an ID to your linearlayout from XML then use below code.
LinearLayout myLinLay=(LinearLayout)findViewById(R.id.my_layout);
Upvotes: 1