以下のコード スニペットを見てください。Android 用です。
TableLayout tbL = (TableLayout) findViewById(R.id.moreInfo_table);
tbL.addView(getRow(key, value), new TableLayout.LayoutParams
(TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT));
private TableRow getRow(String key, String value) {
TableRow tbR = new TableRow(this);
try {
TextView keyTV = new TextView(this);
keyTV.setText("Key " );
keyTV.setTextColor(Color.WHITE);
keyTV.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
keyTV.setTextSize(18.0F);
TextView valueTV = new TextView(this);
valueTV.setText("Value " );
valueTV.setTextColor(Color.WHITE);
valueTV.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
valueTV.setTextSize(18.0F);
tbR.addView(keyTV,new TableLayout.LayoutParams
(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT));
tbR.addView(valueTV,new TableLayout.LayoutParams
(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT));
} catch (Exception e) {
e.printStackTrace();
}
return tbR;
}
問題はどこだ??????!!!