Skip to content Skip to sidebar Skip to footer

How To Programatically Add Linearlayout Object To My Context?

I have my app, it has the following appareance: The table at the bottom side is a TableLayout. In my MainActivity.java I am using the following code to populate the whole layout o

Solution 1:

Instead of <LinearLayout> use <com.your.package.Table> in the xml layout.

Then use the following:

linearLayout = (Table) findViewById(R.id.smarterTable);
for (...) linearLayout.addView(someRow);

Edit regarding your edit

Add this constructor to Table:

publicTable(Context context, AttributeSet attrs) {
    super(context, attrs);
}

Post a Comment for "How To Programatically Add Linearlayout Object To My Context?"