List of usage examples for android.widget TableRow addView
public void addView(View child)
Adds a child view.
From source file:org.mifos.androidclient.main.DepositDueDetailsActivity.java
private void updateContent(SavingsAccountDepositDue details) { mDetails = details;/*from w ww .j a v a2 s . c o m*/ TextView cell; Double nextDeposit, pastDepositAmount, pastDepositsSum = 0.0; cell = (TextView) findViewById(R.id.depositDueDetails_nextDeposit); nextDeposit = details.getNextDueDetail().getDueAmount(); cell.setText(nextDeposit.toString()); if (ValueUtils.hasElements(details.getPreviousDueDetails())) { TableLayout table = (TableLayout) findViewById(R.id.depositDueDetails_table); View view = findViewById(R.id.depositDueDetails_rowInsertPoint); int index = table.indexOfChild(view) + 1; view = findViewById(R.id.depositDueDetails_subTotal_label); TableLayoutHelper helper = new TableLayoutHelper(this, TableLayoutHelper.DEFAULT_TABLE_ROW_SEPARATOR_HEIGHT, view.getPaddingLeft(), view.getPaddingRight()); for (DueOnDate pastDeposit : details.getPreviousDueDetails()) { if (pastDeposit.getDueDate().before(details.getNextDueDetail().getDueDate())) { TableRow row = helper.createTableRow(); cell = helper.createTableCell(DateUtils.format(pastDeposit.getDueDate()), 1); row.addView(cell); pastDepositAmount = pastDeposit.getDueAmount(); cell = helper.createTableCell(pastDepositAmount.toString(), 2); row.addView(cell); table.addView(row, index); index++; table.addView(helper.createRowSeparator(), index); index++; pastDepositsSum += pastDepositAmount; } } } cell = (TextView) findViewById(R.id.depositDueDetails_subTotal); cell.setText(pastDepositsSum.toString()); cell = (TextView) findViewById(R.id.depositDueDetails_totalAmountDue_label); cell.setText(cell.getText() + DateUtils.format(details.getNextDueDetail().getDueDate())); cell = (TextView) findViewById(R.id.depositDueDetails_totalAmountDue); cell.setText(Double.toString(pastDepositsSum + nextDeposit)); }
From source file:com.jeffreyawest.weblogic.monitor.activity.display.DisplayEntityActivity.java
public TableRow getRow(String pLabel, String pValue) { TableRow row = new TableRow(this); TextView textView = new TextView(this); textView.setText(pLabel);//from w w w. j a va 2s . co m float dimension = this.getResources().getDimension(R.dimen.entity_details_table_text_size); textView.setTextSize(dimension); row.addView(textView); textView = new TextView(this); textView.setText(pValue); textView.setTextSize(dimension); row.addView(textView); return row; }
From source file:com.google.adsensequickstart.DisplayReportFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ScrollView sv = new ScrollView(getActivity()); TableLayout tl = new TableLayout(getActivity()); sv.addView(tl);// w w w. j a v a2s . co m if (displayReportController == null) { return sv; } AdsenseReportsGenerateResponse response = displayReportController.getReportResponse(); TableLayout.LayoutParams tableRowParams = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); tableRowParams.setMargins(10, 10, 10, 10); TableRow.LayoutParams tvParams = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); tvParams.setMargins(10, 10, 10, 10); List<Headers> headers = response.getHeaders(); TableRow tr = new TableRow(getActivity()); tl.addView(tr); for (Headers header : headers) { TextView tv = new TextView(getActivity()); tv.setText(header.getName()); tr.setLayoutParams(tableRowParams); tr.addView(tv); } if (response.getRows() != null && !response.getRows().isEmpty()) { for (List<String> row : response.getRows()) { TableRow trow = new TableRow(getActivity()); tl.addView(trow); for (String cell : row) { TextView tv = new TextView(getActivity()); tv.setText(cell); trow.addView(tv); tv.setLayoutParams(tvParams); tv.setPadding(15, 5, 15, 5); tv.setBackgroundColor(Color.WHITE); } } } return sv; }
From source file:nl.openkvk.MainActivity.java
private void globalSearchResults(Object obj) { {// w ww . j a v a 2s. co m Log.d("Result", obj.toString()); TableLayout tl = (TableLayout) findViewById(R.id.tableOuter); tl.removeAllViews(); JSONResult res = new JSONResult((JSONObject) ((JSONObject) ((JSONArray) obj).get(0)).get("RESULT")); if (res.size() < 1) { TextView v1 = new TextView(this); v1.setText("Niets gevonden voor deze zoekvraag."); TableRow tr = new TableRow(this); tr.addView(v1); tl.addView(tr); } for (int r = 0; r < res.size(); r++) { { TableRow tr = new TableRow(this); TextView v1 = new TextView(this); tr.addView(v1); tl.addView(tr); } print(tl, "Naam: ", res.getValue(r, "bedrijfsnaam")); print(tl, "KvK: ", res.getValue(r, "kvks")); print(tl, "VestNr: ", res.getValue(r, "vestiging")); print(tl, "Type: ", res.getValue(r, "type")); print(tl, "Rechtsvorm: ", res.getValue(r, "rechtsvorm")); print(tl, "Status: ", res.getValue(r, "status")); print(tl, "Website: ", res.getValue(r, "website")); print(tl, "ANBI: ", res.getValue(r, "anbi")); print(tl, "Adres: ", res.getValue(r, "adres")); String po = res.getValue(r, "postcode"); String pl = res.getValue(r, "plaats"); if (po != null || pl != null) { if (po == null) { print(tl, "", pl); } else if (pl == null) { print(tl, "", po); } else { print(tl, "", po + " " + pl); } } { TableRow tr = new TableRow(this); if (res.getValue(r, "kvk") != null && res.getValue(r, "kvks") != null) { Button but = new Button(this); but.setText("Details"); but.setTextSize(10); but.setOnClickListener(new KvkButListener(res.getValue(r, "kvk"), res.getValue(r, "kvks"))); tr.addView(but); } else { tr.addView(new TextView(this)); } tr.addView(new TextView(this)); if (po != null) { Button but = new Button(this); but.setText("Postcode"); but.setTextSize(10); but.setOnClickListener(new PostcodeButListener(po)); tr.addView(but); } tl.addView(tr); } } } }
From source file:org.steveleach.scoresheet.ui.PlayersFragment.java
private void addHeader(String text, TableRow headers, int width) { TextView view = new TextView(activity); view.setTextAppearance(activity, R.style.gameReportTextStyle); view.setText(text);//from w w w . ja v a2 s. co m view.setWidth(width); headers.addView(view); }
From source file:com.jeffreyawest.weblogic.monitor.activity.display.DisplayEntityActivity.java
public TableRow getRow(int pStringId, String pValue) { TableRow row = new TableRow(this); TextView textView = new TextView(this); textView.setText(getResources().getString(pStringId) + ":"); float dimension = this.getResources().getDimension(R.dimen.entity_details_table_text_size); textView.setTextSize(dimension);/*from w ww .j a v a 2s . c o m*/ row.addView(textView); textView = new TextView(this); textView.setText(pValue); textView.setTextSize(dimension); row.addView(textView); return row; }
From source file:nl.openkvk.MainActivity.java
public void searchInKvK(View view) { TableLayout tl = (TableLayout) findViewById(R.id.tableOuter); tl.removeAllViews();//from w w w . j a v a2 s . c om EditText _naam = (EditText) findViewById(R.id.inpNaam); EditText _straat = (EditText) findViewById(R.id.inpStraat); EditText _postcode = (EditText) findViewById(R.id.inpPostcode); EditText _plaats = (EditText) findViewById(R.id.inpPlaats); EditText _hdlNaam = (EditText) findViewById(R.id.inpHandelsNaam); String naam = _naam.getText().toString().trim(); String hdlNaam = _hdlNaam.getText().toString().trim(); String straat = _straat.getText().toString().trim(); String postcode = _postcode.getText().toString().trim().toUpperCase(); if (postcode.indexOf(' ') > 0) { postcode = postcode.replace(" ", ""); } String plaats = _plaats.getText().toString().trim(); _naam.setText(naam); _hdlNaam.setText(hdlNaam); _straat.setText(straat); _postcode.setText(postcode); _plaats.setText(plaats); String sql = null; if (naam.length() > 0) { try { Integer kvk = Integer.valueOf(naam); sql = "/json/select * from kvk where kvks=" + kvk; } catch (Exception ignore) { sql = "/json/select * from kvk where bedrijfsnaam ilike '" + naam + "%'"; } if (straat.length() > 0) { sql += " and adres ilike '" + straat + "%'"; } if (plaats.length() > 0) { sql += " and plaats ilike '" + plaats + "%'"; } if (postcode.length() > 0) { sql += " and postcode ilike '" + postcode + "%'"; } sql += " LIMIT 1000;"; } else if (hdlNaam.length() > 0) { sql = "/json/select * from kvk,kvk_handelsnamen where kvk.kvks=kvk_handelsnamen.kvks and handelsnaam ilike '" + hdlNaam + "%'"; sql += " LIMIT 1000;"; } else if (straat.length() > 0 && (plaats.length() > 0 || postcode.length() > 0)) { sql = "/json/select * from kvk where adres ilike '" + straat + "%'"; if (plaats.length() > 0) { sql += " and plaats ilike '" + plaats + "%'"; } if (postcode.length() > 0) { sql += " and postcode ilike '" + postcode + "%'"; } sql += " LIMIT 1000;"; } else if (postcode.length() == 6) { sql = "/json/select * from kvk where postcode='" + postcode + "'"; sql += " LIMIT 1000;"; } if (sql != null) { TextView tv = new TextView(this); tv.setText("Even geduld AUB..."); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); new Caller(handler, handler.holder, sql, 2).start(); } else { { TextView tv = new TextView(this); tv.setText("Ongeldige invoer."); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Geef een (gedeelte van) een bedrijfsnaam in. Of geef het KvK nummer."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Geef eventueel ook (het begin van) een straat, postcode en/of plaatsnaam in."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Of geef een straat (mag met huisnummer) en een plaats en/of een postcode in."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Of geef alleen een volledige postcode in."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } } }
From source file:mx.udlap.is522.tedroid.activity.ScoresActivity.java
/** @return una fila con el texto de que no hay puntajes. */ private TableRow emptyScoresRow() { TableRow row = new TableRow(this); TextView noScoresText = new TextView(this); noScoresText.setText(R.string.no_scores_message); applyPrimaryStyleTo(noScoresText);/*from www . java 2 s. co m*/ row.addView(noScoresText); return row; }
From source file:lk.ac.mrt.cse.dbs.simpleexpensemanager.ui.ExpenseLogsFragment.java
private void generateTransactionsTable(View rootView, TableLayout logsTableLayout, List<Transaction> transactionList) { for (Transaction transaction : transactionList) { TableRow tr = new TableRow(rootView.getContext()); TextView lDateVal = new TextView(rootView.getContext()); SimpleDateFormat sdf = new SimpleDateFormat(getActivity().getString(R.string.config_date_log_pattern)); String formattedDate = sdf.format(transaction.getDate()); lDateVal.setText(formattedDate); tr.addView(lDateVal); TextView lAccountNoVal = new TextView(rootView.getContext()); lAccountNoVal.setText(transaction.getAccountNo()); tr.addView(lAccountNoVal);// w w w. j av a 2 s . com TextView lExpenseTypeVal = new TextView(rootView.getContext()); lExpenseTypeVal.setText(transaction.getExpenseType().toString()); tr.addView(lExpenseTypeVal); TextView lAmountVal = new TextView(rootView.getContext()); lAmountVal.setText(String.valueOf(transaction.getAmount())); tr.addView(lAmountVal); logsTableLayout.addView(tr); } }
From source file:com.airflo.FlightDetailFragment.java
/** * Method to build and add the View. It will consider preferences for * certain items, textsizes, and handle empty fields. */// ww w . j a v a 2s . co m public void addViews() { table.setColumnShrinkable(1, true); sharedPrefs = PreferenceManager.getDefaultSharedPreferences(OnlyContext.getContext()); float detSize = Float.valueOf(sharedPrefs.getString("detailtextsize", "20")); boolean hideEmpty = sharedPrefs.getBoolean("detailListPrefEmpty", true); for (Identi identi : FlightData.identis.getIdentis()) { String prefKey = "detailListPref" + identi.getKey(); if (sharedPrefs.getBoolean(prefKey, true)) { if (hideEmpty) { if (mItem.getFromKey(identi.getKey()) == null) continue; if (mItem.getFromKey(identi.getKey()).equals("")) continue; } if (identi.getKey().equals("tag")) { if (mItem.getFromKey(identi.getKey()).length() > 0) { LinearLayout lnn = (LinearLayout) rootView.findViewById(R.id.LinearAdditionLayout); String[] tags = mItem.getFromKey(identi.getKey()).split(";"); for (String tag : tags) { if (tag.equals("off-field")) tag = "off_field"; int resID = getResources().getIdentifier(tag, "drawable", "com.airflo"); ImageView img = new ImageView(getActivity()); img.setImageResource(resID); img.setPadding(8, 14, 8, 0); lnn.addView(img); } } } else { TableRow row = new TableRow(getActivity()); header = new TextView(getActivity()); header.setSingleLine(); header.setTextSize(detSize); header.setText(identi.getStringRep()); header.setPadding(6, 4, 10, 4); row.addView(header); cell = new TextView(getActivity()); cell.setSingleLine(false); cell.setTextSize(detSize); cell.setText(mItem.getFromKey(identi.getKey())); cell.setPadding(6, 4, 6, 4); row.addView(cell); table.addView(row); } } } }