Android 获取图片固定大小的缩略图
2010-06-12 19:50:00 来源:WEB开发网核心提示:position = position + mImageDirs.size();}// 获取这个图片的宽和高Bitmap bm = BitmapFactory.decodeFile(this.mImageDirs.get(position % mImageDirs.size()), options); //此时返回bm
position = position + mImageDirs.size();
}
// 获取这个图片的宽和高
Bitmap bm = BitmapFactory.decodeFile(this.mImageDirs
.get(position % mImageDirs.size()), options); //此时返回bm为空
options.inJustDecodeBounds = false;
int be = options.outHeight / 20;
if(be%10 !=0)
be+=10;
be=be/10;
if (be <= 0)
be = 1;
options.inSampleSize = be;
bm = BitmapFactory.decodeFile(this.mImageDirs.get(position
% mImageDirs.size()), options);
int w = bm.getWidth();
int h = bm.getHeight();
w = w *200 /h;
i.setImageBitmap(bm);
更多精彩
赞助商链接