
正文
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~






