我将实现一个LinearLayout
输入字段是根据数据库表的字段数以编程方式生成的。
不幸的是,当我尝试设置属性时:textApperance
就像textApperanceLarge
在 中一样TextView
,它不起作用。下面是我的代码...
for (int i = 0; i < selectedProducts; i++) {
premLayout[i] = new LinearLayout(this);
premLayout[i].setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
premLayout[i].setOrientation(LinearLayout.HORIZONTAL);
premLayout[i].setGravity(Gravity.TOP);
premTextView[i] = new TextView(this);
premTextView[i].setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
2.0f));
premTextView[i].setTextAppearance(this, android.R.attr.textAppearanceLarge);
premTextView[i].setText(premiumChannels.get(i));
premTextView[i].setId(i + 600);
int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics());
premTextView[i].setWidth(px);
premLayout[i].addView(premTextView[i]);