Code example for TableRow

Methods: addView, setId

0
 
    public boolean addRow(int val) {
        boolean output;
        TableLayout table = (TableLayout) findViewById(R.id.TableLayout01);
 
        TableRow row = (TableRow) new TableRow(this);
        int curid = 0;
        curid = counter + 201;
        row.setId(curid);
        SeekBar sb = new SeekBar(this);
        sb.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,
                TableRow.LayoutParams.WRAP_CONTENT, 1));
        sb.setFocusable(true);
        sb.setMax(100);
        sb.setProgress(val);
        sb.setPadding(10, 0, 0, 0);
        sb.setId(counter + 101);
        row.addView(sb);
        sb.setOnSeekBarChangeListener(sbChange);
 
        TextView t = new TextView(this);
        String s = Integer.toString(sb.getProgress());
        t.setText(s);
        t.setId(counter + 1001);
        t.setTextSize(20);
        t.setMinEms(3);
        t.setPadding(10, 0, 0, 0);
        t.setInputType(InputType.TYPE_CLASS_NUMBER);
        row.addView(t);
 
        TextView onoff = new TextView(this);
        String str = "  " + getString(R.string.haptic_vibe_desc);
        onoff.setTextColor(Color.WHITE);
        if (counter % 2 == 0) {
            str = "  " + getString(R.string.haptic_delay_desc);
            onoff.setTextColor(Color.RED);
        } 
        onoff.setPadding(0, 0, 15, 0);
        onoff.setText(str);
        onoff.setId(counter + 401);
        row.addView(onoff);
 
        table.addView(row);
        counter = table.getChildCount();
        output = true;
        checkRowColors(); 
Connect your IDE to all the code out there  Get Codota for Java