Example usage for android.widget TableRow TableRow

List of usage examples for android.widget TableRow TableRow

Introduction

In this page you can find the example usage for android.widget TableRow TableRow.

Prototype

public TableRow(Context context, AttributeSet attrs) 

Source Link

Document

Creates a new TableRow for the given context and with the specified set attributes.

Usage

From source file:org.mythdroid.activities.Guide.java

/**
 * Get a header row containing column time values
 * @return header TableRow// w ww  . j a v a 2 s.  co  m
 */
private TableRow getHeader() {

    final TableRow row = new TableRow(this, null);
    TextView tv = new TextView(this, null);
    tv.setLayoutParams(hdrDateLayout);
    tv.setPadding(4, 4, 4, 4);
    tv.setBackgroundColor(0xffd0d0ff);
    tv.setTextColor(0xff161616);
    tv.setMaxLines(1);
    tv.setText(hdrDate);
    row.addView(tv);

    int j = 0;

    for (int i = 1; i < times.length; i += hdrSpan) {
        tv = new TextView(this, null);
        tv.setLayoutParams(hdrTimeLayout);
        tv.setPadding(4, 4, 4, 4);
        tv.setBackgroundColor(0xffd0d0ff);
        tv.setTextColor(0xff161616);
        tv.setMaxLines(1);
        tv.setText(hdrTimes[j++]);
        row.addView(tv);
    }

    return row;

}

From source file:org.mythdroid.activities.Guide.java

/**
 * Get a spacer row//from   www . ja  va2 s  . co  m
 * @return a spacer TableRow
 */
private TableRow getSpacer() {

    final TableRow row = new TableRow(this, null);
    LayoutParams params = new LayoutParams();
    params.height = 1;
    row.setLayoutParams(params);
    View view = new View(this, null);
    params = new LayoutParams();
    params.height = 1;
    params.width = chanWidth;
    params.column = 0;
    params.span = 1;
    view.setLayoutParams(params);
    row.addView(view);

    for (int i = 1; i < times.length; i++) {
        view = new View(this, null);
        view.setLayoutParams(spacerLayout);
        row.addView(view);
    }

    return row;

}