如何从文件java全屏显示背景图像?

时间:2012-04-24 15:55:42

标签: android android-layout android-widget

我想以全屏方式查看背景图像。我该怎么做?我想从Java代码中设置我的* TableLayout 全屏。

tableLayout = new TableLayout(this);
tableLayout.setGravity(Gravity.CENTER); 
tableLayout.setBackgroundResource(R.drawable.lavagna);

1 个答案:

答案 0 :(得分:5)

tableLayout = new TableLayout(this);
TableLayout.LayoutParams params = new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
tableLayout.setGravity(Gravity.CENTER); 
tableLayout.setBackgroundResource(R.drawable.lavagna);
tableLayout.setLayoutParams(params);

尝试以上代码将tablelayout设置为全屏