Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.view.Gravity; import android.widget.TableRow; import android.widget.TextView; import android.widget.TableRow.LayoutParams; public class Main { private static TableRow generateAfiTblRow(Context context, String first, String second) { TableRow tr = new TableRow(context); tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); LayoutParams childLp = new LayoutParams(0, LayoutParams.FILL_PARENT, 1); TextView amount = new TextView(context); amount.setText(first); amount.setGravity(Gravity.CENTER); tr.addView(amount, childLp); TextView score = new TextView(context); score.setText(second); score.setGravity(Gravity.CENTER); tr.addView(score, childLp); return tr; } }