1
我在表格佈局中有表格行,我需要讀取所有行並將數據移動到sql。我如何通過行讀取表下一行需要讀取一行並進入第2行和讀取插入android表格閱讀行的表格佈局
代碼到錶行:
TableLayout l1 = (TableLayout) findViewById(R.id.table1);
l1.setStretchAllColumns(true);
l1.bringToFront();
TableRow tr0 = new TableRow(getBaseContext());
TextView tv1 = new TextView(getBaseContext());
TextView tv2 = new TextView(getBaseContext());
TextView tv3 = new TextView(getBaseContext());
TextView tv4 = new TextView(getBaseContext());
TextView tv5 = new TextView(getBaseContext());
tv1.setTextColor(Color.BLACK);
tv2.setTextColor(Color.BLACK);
tv3.setTextColor(Color.BLACK);
tv4.setTextColor(Color.BLACK);
tv5.setTextColor(Color.BLACK);
tv1.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
tv2.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
tv3.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
tv4.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
tv5.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
tv1.setText(Integer.toString(id_row=id_row+1));
tv2.setText(e_entrbond_calcname.getText().toString());
tv3.setText(e_entrybonds_mdin1.getText().toString());
tv4.setText(e_entrybonds_dain1.getText().toString());
tv5.setText(e_entrybonds_details2.getText().toString());
tr0.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr0.addView(tv1);
tr0.addView(tv2);
tr0.addView(tv3);
tr0.addView(tv4);
tr0.addView(tv5);
l1.addView(tr0);
thnxs sir :) 你救了我 –