java - Possible to get reference to a View without setting the ContentView of an Activity -


i want able reference relativelayout in same way as

relativelayout relative = (relativelayout)findviewbyid(r.id.relative);

but without setting contentview of activity. think may have infalter? ultimate aim , add child view of custom view object.

yes, can use layoutinflater. example:

layoutinflater inflater = (layoutinflater)getsystemservice(context.layout_inflater_service);     view mv = inflater.inflate(r.layout.yourlayout, null); 

and could...

relativelayout relative = (relativelayout)mv.findviewbyid(r.id.relative); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -