Code example for TableRow.LayoutParams

Methods: setMargins

0
       initGrantDetailTbl(); 
    } 
 
    private void initGrantDetailTbl() { 
    	GrantStep = HttpHelper.getGrantStepsHelper(grant.getId());
        TableRow.LayoutParams params1 = new TableRow.LayoutParams(LayoutParams.FILL_PARENT, 50);
        // TableRow.LayoutParams params2 = new TableRow.LayoutParams(LayoutParams.FILL_PARENT, 60); 
        params1.setMargins(1, 1, 1, 1);
 
        for (int i = 0; i < GrantStep.size(); i++) {
            TableRow tr = new TableRow(context);
            Steps step = GrantStep.get(i);
            TextView tv1 = new TextView(context);
            tv1.setLayoutParams(params1);
            tv1.setPadding(1, 1, 1, 1);
            tv1.setGravity(Gravity.CENTER);
            tv1.setText("Step " + (i + 1));
            tv1.setTextSize(14f);
            tv1.setTextColor(0xFF000000);
            tv1.setBackgroundResource(R.drawable.tbl_cell_bg0);
            tv1.setShadowLayer(3, 2, 2, Color.GRAY); // java int colors