Search in sources :

Example 6 with TableRow

use of android.widget.TableRow in project android-nfc-paycardreader by rayyan.

the class ECCardInfosActivity method addAIDRow.

private void addAIDRow(CharSequence left, CharSequence right) {
    TextView t1 = new TextView(this);
    t1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    t1.setPadding(0, 0, (int) (getResources().getDisplayMetrics().density * 10 + 0.5f), 0);
    t1.setTextAppearance(this, android.R.attr.textAppearanceMedium);
    t1.setText(left);
    TextView t2 = new TextView(this);
    t2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    t2.setText(right);
    TableRow tr = new TableRow(this);
    tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    tr.addView(t1);
    tr.addView(t2);
    TableLayout t = (TableLayout) findViewById(R.id.table_features);
    t.addView(tr, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
Also used : LayoutParams(android.widget.TableRow.LayoutParams) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout)

Example 7 with TableRow

use of android.widget.TableRow in project platform_frameworks_base by android.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 8 with TableRow

use of android.widget.TableRow in project glimmr by brk3.

the class ExifInfoFragment method addKeyValueRow.

/**
     * Creates a TableRow with two columns containing TextViews, and adds it to
     * the main TableView.
     */
@SuppressWarnings("deprecation")
private void addKeyValueRow(String key, String value) {
    TableLayout tl = (TableLayout) mLayout.findViewById(R.id.extraExifInfo);
    /* Create the TableRow */
    TableRow tr = new TableRow(mActivity);
    /* Create the left column for the key */
    TextView textViewKey = new TextView(mActivity);
    textViewKey.setText(key);
    TableRow.LayoutParams leftColParams = new TableRow.LayoutParams(0, TableLayout.LayoutParams.WRAP_CONTENT, 1f);
    textViewKey.setLayoutParams(leftColParams);
    tr.addView(textViewKey);
    /* Create the right column for the value */
    TextView textViewValue = new TextView(mActivity);
    textViewValue.setText(value);
    textViewValue.setTextColor(mActivity.getResources().getColor(R.color.flickr_pink));
    textViewValue.setMaxLines(1);
    textViewValue.setEllipsize(TextUtils.TruncateAt.END);
    TableRow.LayoutParams lp = new TableRow.LayoutParams(0, TableLayout.LayoutParams.WRAP_CONTENT, 1f);
    /* left, top, right, bottom */
    lp.setMargins(8, 0, 0, 0);
    textViewValue.setLayoutParams(lp);
    tr.addView(textViewValue);
    /* Add the row to the table */
    tl.addView(tr);
}
Also used : TableRow(android.widget.TableRow) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout)

Example 9 with TableRow

use of android.widget.TableRow in project android_frameworks_base by DirtyUnicorns.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 10 with TableRow

use of android.widget.TableRow in project android_frameworks_base by AOSPA.

the class AddColumnTest method testWidths.

@MediumTest
public void testWidths() throws Exception {
    sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
    getInstrumentation().waitForIdleSync();
    TableRow row1 = (TableRow) mTable.getChildAt(0);
    TableRow row2 = (TableRow) mTable.getChildAt(1);
    assertTrue(row1.getChildCount() < row2.getChildCount());
    for (int i = 0; i < row1.getChildCount(); i++) {
        assertEquals(row2.getChildAt(i).getWidth(), row1.getChildAt(i).getWidth());
    }
}
Also used : TableRow(android.widget.TableRow) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

TableRow (android.widget.TableRow)43 TextView (android.widget.TextView)25 View (android.view.View)21 TableLayout (android.widget.TableLayout)14 Button (android.widget.Button)8 ImageView (android.widget.ImageView)8 CPU (brunonova.drmips.simulator.CPU)7 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 ViewGroup (android.view.ViewGroup)4 Question (org.eyeseetea.malariacare.data.database.model.Question)4 SuppressLint (android.annotation.SuppressLint)3 ListView (android.widget.ListView)3 ScrollView (android.widget.ScrollView)3 Option (org.eyeseetea.malariacare.data.database.model.Option)3 AOptionQuestionView (org.eyeseetea.malariacare.views.question.AOptionQuestionView)3 IImageQuestionView (org.eyeseetea.malariacare.views.question.IImageQuestionView)3 IMultiQuestionView (org.eyeseetea.malariacare.views.question.IMultiQuestionView)3 IQuestionView (org.eyeseetea.malariacare.views.question.IQuestionView)3 NumberRadioButtonMultiquestionView (org.eyeseetea.malariacare.views.question.multiquestion.NumberRadioButtonMultiquestionView)3 DynamicStockImageRadioButtonSingleQuestionView (org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView)3