首页 > 代码库 > android tablelayout 显示图片

android tablelayout 显示图片

当在tablelayout中显示图片时,设置imageView为固定大小时,会出现divide by zero 错误

将LayoutParams 改为 TableRow.LayoutParams即可

TableRow.LayoutParams params = new TableRow.LayoutParams(50, 50);//50 x 50

TableRow row = new TableRow(activity);

ImageView imgView = new ImageView(activity);

imgView.setLayoutParams(params);

imageLoader.displayImage(fileName, imgView, options);//显示图片

row.addView(imgView);

vh.imgLayout.addView(row);

mark~

android tablelayout 显示图片