protected void addDataRow(LayoutInflater inflater, TableLayout tlb, String cell1Text, String cell2Text) { final TableRow row = (TableRow) inflater.inflate(R.layout.usb_table_row_data, null); final TextView tv1 = (TextView) row.findViewById(R.id.usb_tablerow_cell1); final TextView tv2 = (TextView) row.findViewById(R.id.usb_tablerow_cell2); tv1.setText(cell1Text); tv2.setText(cell2Text); tlb.addView(row); }
/** * Populate the table of common isotopes. */ private void populateIsotopes() { final Isotope[] isotopes = Isotopes.getIsotopes(mElement.number); if(isotopes != null) { final LayoutInflater inflater = getLayoutInflater(); for(Isotope isotope : isotopes) { final TableRow tableRow = (TableRow)inflater.inflate(R.layout.isotope_table_row, mIsoTable, false); final TextView symbolText = tableRow.findViewById(R.id.isoSymbol); symbolText.setText(isotope.getSymbol()); final TextView massText = tableRow.findViewById(R.id.isoMass); massText.setText(DECIMAL_FORMAT.format(isotope.mass)); mIsoTable.addView(tableRow); } } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.ingredients_fragment, container, false); this.recipe = ((RecipeActivity) getActivity()).mRecipe; TableLayout table = (TableLayout) rootView.findViewById(R.id.ingredientsTable); for (Recipe.Ingredient ingredient : recipe.getIngredients()) { TableRow row = (TableRow) inflater.inflate(R.layout.ingredients_row, null); ((TextView) row.findViewById(R.id.attrib_name)).setText(ingredient.getAmount()); ((TextView) row.findViewById(R.id.attrib_value)).setText(ingredient .getDescription()); table.addView(row); } return rootView; } }
TextView textView1 = (TextView) row.findViewById(R.id.row_cell_1); TextView textView2 = (TextView) row.findViewById(R.id.row_cell_2); TextView textView3 = (TextView) row.findViewById(R.id.row_cell_3); TextView textView4 = (TextView) row.findViewById(R.id.row_cell_4);
TextView textView1 = (TextView) row.findViewById(R.id.row_cell_1); TextView textView2 = (TextView) row.findViewById(R.id.row_cell_2); TextView textView3 = (TextView) row.findViewById(R.id.row_cell_3); TextView textView4 = (TextView) row.findViewById(R.id.row_cell_4);