TableLayout tblLayout = (TableLayout)findViewById(R.id.tableLayout); TableRow row = (TableRow)tblLayout.getChildAt(0); // Here get row id depending on number of row Button button = (Button)row.getChildAt(XXX); // get child index on particular row String buttonText = button.getText().toString();
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 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` } }
final ScrollView sv = (ScrollView) findViewById(R.id.scrollView1); TableLayout tl = (TableLayout) findViewById(R.id.arrivalstable); int index = 40; final View child = tl.getChildAt(index); new Handler().post(new Runnable() { @Override public void run() { sv.smoothScrollTo(0, child.getBottom()); } });
TableLayout contact_table = (TableLayout)findViewById(R.id.contact_table); final View row=contact_table.getChildAt(i); row.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ // TODO Auto-generated method stub row_id=contact_table.indexOfChild(row); } });
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. }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo){ TableLayout yourTable = (TableLayout) findViewById(R.id.yourTableId); TableRow yourTableRow = yourTable.getChildAt(INDEX_OF_YOUR_ROW_IN_THE_TABLE); if(v.getId() == yourTableRow.getId()){ yourTable.removeView(yourTableRow); } }
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++; }
public void anotherMethod(){ TableLayout tl = (TableLayout) findViewById(R.id.table_layout); int tableRowIndex = 0; TableRow tr = (TableRow) tl.getChildAt(tableRowIndex); int textViewIndex = 1; TextView textView = (TextView) tr.getChildAt(textViewIndex); textView.setText("New Text"); }
private View getCellAtPos(TableLayout table, int pos) { TableRow row = (TableRow) table.getChildAt(pos / NUMBER_OF_COLUMNS); return row.getChildAt(pos % NUMBER_OF_COLUMNS); }
TableLayout tblLayout = (TableLayout)findViewById(R.id.tableLayout); TableRow row = (TableRow)tblLayout.getChildAt(YYY); // Here get row id depending on number of row Edittext edittext= (Edittext)row.getChildAt(XXX); String text = edittext.gettext().toString();
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); } } }
.... 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); } }
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 } } } }
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 tbL = (TableLayout) findViewById(R.id.tbL); TableRow row1=(TableRow)tbL.getChildAt(0); SeekBar sb1=(SeekBar) row1.getChildAt(0); TextView txt1_1=(TextView) row1.getChildAt(1); TextView txt1_2=(TextView) row1.getChildAt(2); ..etc
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); }