我在 TextView 中遇到了 Android LayoutParams 的问题。我想在大小为 200 dip x 200 dip 的框中显示文本。但什么都没有显示。这是代码:
tr = new TableRow(this);
TextView phone = new TextView(this);
phone.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
phone.setLines(20);
phone.setText(Html.fromHtml("<b>Beschreibung</b><br /><br />"));
phone.append(poi.getDescription());
tr.addView(phone,new ViewGroup.LayoutParams(calculatePxs(200),calculatePxs(200)));
tr.setPadding(10, 15, 10, 15);
v = new View(this);
v.setBackgroundColor(Color.rgb(51, 51, 51));
table.addView(tr,new TableLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
table.addView(v,new TableLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
1));