I have a user interface, I build it dynamically. I would like to put some component in the xml resource file. So I:
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+android:id/titreItem" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView>
... in the res/layout/titreitem.xml , as I see anywhere. But I donβt understand how to make it enable my user interface. So, inside activity.onCreate , I want to do something like:
RelativeLayout myBigOne = new RelativeLayout(this); TextView thingFromXML = [what here ? ]; myBigOne.addView(thingFromXML); setContentView(myBigOne);
source share