我想做一个适合所有的智能手机的全屏幕视图。使用这段代码创建一个可以水平和垂直滚动的表格布局tablelayout。同时我也想查看集中在布局中编辑框edittext的模型。如何给所有的Activity设置全屏幕布局?谢谢。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.seconda);
HorizontalScrollView HSC = new HorizontalScrollView(this);
ScrollView VSC = new ScrollView(this);
VSC.setBackgroundResource(R.drawable.lavagna_psd);
tableLayout = new TableLayout(this);
tableLayout.setGravity(Gravity.CENTER);
values = new EditText[3][3];
for (int i = 0; i < 3; i++) {
tableRow = new TableRow(this);
tableRow.setGravity(Gravity.CENTER);
for (int j = 0; j < 3 ; j++) {
values[i][j] = new EditText(this);
values[i][j].setHint("r: " + (i) + " " + "c: " + (j));
values[i][j].setPadding(10, 10, 10, 10);
tableRow.addView(values[i][j]);
}
tableLayout.addView(tableRow);
}
VSC.addView(tableLayout);
HSC.addView(VSC);
setContentView(HSC);
}