textview
テキストが画面の幅を超えた場合に、幅だけを埋めて新しい行を開始するようにテキストを作成する方法は? Javaコードからコントロールを追加しようとしています:
contentTable = (TableLayout) findViewById(R.id.contentTable);
TableRow row = new TableRow(getApplicationContext());
TextView tv1 = new TextView(getApplicationContext());
TextView tv2 = new TextView(getApplicationContext());
tv1.setGravity(Gravity.RIGHT);
tv2.setGravity(Gravity.RIGHT);
row.setGravity(Gravity.RIGHT);
tv1.setTextColor(Color.BLACK);
tv2.setTextColor(Color.BLACK);
tv1.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1f));
tv2.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1f));
tv1.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
tv2.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
tv1.setText(recipe.ingredients.get(i).name));
tv2.setText(" "+recipe.ingredients.get(i).quantity);
setTypeFace(tv1,tv2);
row.addView(tv1);
row.addView(tv2);
contentTable.addView(row);