//Resize elements in the table TableLayout layout = (TableLayout) findViewById(R.id.TLayout); for (int i = 0; i < layout.getChildCount(); i++) { ...
private void cleanTable(TableLayout table) { int childCount = table.getChildCount(); // Remove all rows except the first one if (childCount > 1) { table.removeViews(1, childCount - 1); } }
TableLayout table = (TableLayout) findViewById(R.id.give_it_an_id); TextView courtText; // For each row for (int i = 0; i < table.getChildCount(); i++) { // Get the one `courtText` in this row courtText = table.getChildAt(i).findViewById(R.id.courtText); if (courtText != null) { // Do something to `courtText` } }
private void deleteRows(){ TableLayout tablaPos = (TableLayout) findViewById(R.id.tabla_pos); for(int i = 0; i < tablaPos.getChildCount(); i++){ tablaPos.removeViewAt(i); } }
TableLayout tableLayout = null; for(int n = 0, s = tableLayout.getChildCount(); n < s; ++n) { TableRow row = (TableRow)tableLayout.getChildAt(n); TextView name = (TextView)row.findViewById(R.id.tv_name); }
TableLayout x = (TableLayout) findViewById(R.id.table_id); for(int i=0;i<x.getChildCount();i++){ TableRow tr = (TableRow) x.getChildAt(index); //Do here with table row, what u want to do. }
int index = 0; TableLayout tableLayout = findViewById(R.id.table_layout); for(int n = 0, s = tableLayout.getChildCount(); n < s; ++n) { double debt = debtList.get(index); double fee = feeList.get(index); TableRow row = (TableRow) tableLayout.getChildAt(n); TextView cell = (TextView) row.findViewById(R.id.textview_cell); name.setText("debt = " + debt + ", fee = " + fee); index++; }
TableLayout tableView = (TableLayout)findViewById(R.id.mydetails_tableview); View mytempView=null; int noOfChilds=tableView.getChildCount(); for(int i=0;i<noOfChilds;i++) { mytempView=tableView.getChildAt(i); if(i%2==0) { View vv=((TableRow) mytempView).getChildAt(1); if(vv instanceof EditText) { //Log.v("This one is edit text---", "here there"); ((EditText) vv).setText(""); } } }
final TableLayout tview = (TableLayout) findViewById(R.id.tblGridStructure); final JSONArray JarraymenuItems = {item1,it3m1mwer,wer,ds};//your list of items for (int i = 0; i < JarraymenuItems.length(); i++) { ableRow tr = new TableRow(this); tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); tview.addView(tr, LayoutParams.FILL_PARENT, 45); T final TextView etprice = new TextView(this); etprice.setText("your text value wat u want to display"); tr.addView(etprice ); int count = tview.getChildCount(); if (count % 2 != 0) tr.setBackgroundColor(Color.parseColor("#E3E3E3")); }
public void nextWeek() { if (mCurrentWeekIndex + 1 >= mTableBody.getChildCount()) { mCurrentWeekIndex = 0; nextMonth(); } else { mCurrentWeekIndex++; collapseTo(mCurrentWeekIndex); } }
.... onClick(View v) { final TableLayout rel=(TableLayout)findViewById(R.id.tab1); for(int x=0; x<rel.getChildCount(); x++) { View v = rel.getChildAt(x); rel.removeView(v); } .... }
TableLayout table = (TableLayout) findViewById(R.id.tblScores); for(int i = 0; i < table.getChildCount(); i = 0) { View child = table.getChildAt(0); if (child != null && child instanceof TableRow) { TableRow row = (TableRow) child; row.removeAllViews(); table.removeViewAt(i); } }
for (int i = 1000 + miTlCnt; i > 1000; i--) { TableLayout tl = (TableLayout)findViewById(i); if (tl != null) { for (int j = 0; j < tl.getChildCount(); j++) { TableRow row = (TableRow)tl.getChildAt(j); CheckBox chkCompleted = (CheckBox)row.getChildAt(1); } } }
TableLayout layout = (TableLayout) findViewById(R.id.IdTable); for (int i = 0; i < layout.getChildCount(); i++) { View child = layout.getChildAt(i); if (child instanceof TableRow) { TableRow row = (TableRow) child; for (int x = 0; x < row.getChildCount(); x++) { View view = row.getChildAt(x); view.setEnabled(false); } } }
TableLayout tl; tl=(TableLayout)findViewById(R.id.layout); for(int i=0;i<tl.getChildCount();i++){ View v=tl.getChildAt(i); if(v instanceof TableRow){ for(int j=0;j<v.getChildCount();j++){ View innerView=v.getChildAt(j); if(innerView instanceof ImageView){ imageList.add((ImageView)innerView); idList.add(innerView.getId()); } } } }
TableLayout layout = (TableLayout) findViewById(R.id.Table_ID); for (int i = 0; i < layout.getChildCount(); i++) { View child = layout.getChildAt(i); if (child instanceof TableRow) { TableRow row = (TableRow) child; for (int x = 0; x < row.getChildCount(); x++) { View view = row.getChildAt(x);//Here you get Your Button View } } }
TableLayout tableLayout = (TableLayout) findViewById(R.id.tableLayout); View child; TableRow tableRow; // As the first line is headings, skip the first row for (int i = 1; i < tableLayout.getChildCount(); i++) { child = tableLayout.getChildAt(i); if (child instanceof TableRow) { tableRow = (TableRow) child; // As the first line has labels, skip the first column for (int j = 1; j < tableRow.getChildCount(); j++) { child = tableRow.getChildAt(j); if (child instanceof RadioButton) { ((RadioButton) child).setOnCheckedChangeListener(onCheckedChangeListener); } } } }
TableLayout table = (TableLayout)findViewById(R.id.scrollable_part); int sourceColumnIndex = 0; int targetColumnIndex = 1; for (int i = 0; i < table.getChildCount(); i++) { TableRow tr = (TableRow)table.getChildAt(i); View v = tr.getChildAt(sourceColumnIndex); tr.removeViewAt(sourceColumnIndex); tr.addView(v, targetColumnIndex); }
TableLayout layout=(TableLayout) findViewById(R.id.Layout); for(int i=0;i<layout.getChildCount();i++) { if (layout.getChildAt(i) instanceof TableRow) { TableRow tableRow = (TableRow) layout.getChildAt(i); for(int j=0;j<tableRow.getChildCount();j++) { if (tableRow.getChildAt(j) instanceof Button) { Button button = (Button) tableRow.getChildAt(j); //your button is here } } } }
@Override public void onClick(View view) { TableLayout table = (TableLayout) view.getParent().getParent(); for (int l = 0; l < table.getChildCount(); l++) { TableRow row = (TableRow) table.getChildAt(l); for (int i = 0; i < row.getChildCount(); i++) { ((CheckedTextView) (row.getChildAt(i))).setChecked(false); SCChannelFilterItem item = (SCChannelFilterItem) row.getChildAt(i).getTag(R.id.key_filter_item); item.setChecked(false); } } ((CheckedTextView) view).setChecked(true); SCChannelFilterItem item = (SCChannelFilterItem) view.getTag(R.id.key_filter_item); item.setChecked(true); } });