I'm looking for a way to include a layout programmatically instead of using the XML tag include
like in my example:
<include layout="@layout/message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.75"/>
Need to change this parameter "layout="@layout/message" programmatically, please.
Any idea how to do this?
In Mono.Droid / Xamarin this worked for me:
Use a
ViewStub
instead ofinclude
:Then in code, get a reference to the stub, set its layout resource, and inflate it: