我已经在LinearLayout中以编程方式创建了一个TextView:
LinearLayout filmTitleContainer = new LinearLayout(ctx);
TextView filmName = new TextView(ctx);
filmName.setBackgroundColor(Color.rgb(Color.YELLOW));
filmName.setText(this.screeningTime+" "+this.name);
文本视图被缩小了:
如何将文本设置为占据整个屏幕宽度?当使用XML布局文件时,我会设置android:layout_width="match_parent"
。相应的Java代码是什么?