怎么样能在一个文件夹上显示文件夹里面的图片内容,就像windows装图片的文件夹那样,在文件夹上显示4个缩略图
解决方案 »
- 应用植入万普世纪广告出错????????
- 讨论一下Android程序的构架设计,请充分发表你的看法!
- android是如何判断一个apk来源的?
- 求助
- 关于客户端从服务器下载图片
- 关于Binary XML file line #:error inflating class 的问题。求助!
- ADT 中, 已经用向导建了一个项目工程, 想在这个工程中加一个服务(可能要加一个java文件), 请问, 这个如何加?
- android能调用wcf吗?怎么调用?
- 关于安卓手机通过蓝牙推送来电铃声的问题,急!急!急!
- 关于Android studio 的emulator_arm.exe已停止运行
- Android模拟器上网
- 有关于win7 64位 ndk r7的环境配置方法的文章么?
private Bitmap makeMiniThumbBitmap(int width, int height, ImageManager.IImageList images) {
int count = images.getCount();
// We draw three different version of the folder image depending on the number of images in the folder.
// For a single image, that image draws over the whole folder.
// For two or three images, we draw the two most recent photos.
// For four or more images, we draw four photos.
final int padding = 4;
int imageWidth = width;
int imageHeight = height;
int offsetWidth = 0;
int offsetHeight = 0; imageWidth = (imageWidth - padding) / 2; // 2 here because we show two images
imageHeight = (imageHeight - padding) / 2; // per row and column final Paint p = new Paint();
final Bitmap b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas c = new Canvas(b); final Matrix m = new Matrix(); // draw the whole canvas as transparent
p.setColor(0x00000000);
c.drawPaint(p); // draw the mask normally
p.setColor(0xFFFFFFFF);
mFrameGalleryMask.setBounds(0, 0, width, height);
mFrameGalleryMask.draw(c); Paint pdpaint = new Paint();
pdpaint.setXfermode(new android.graphics.PorterDuffXfermode(
android.graphics.PorterDuff.Mode.SRC_IN)); pdpaint.setStyle(Paint.Style.FILL);
c.drawRect(0, 0, width, height, pdpaint); for (int i = 0; i < 4; i++) {
if (mPausing) {
return null;
} Bitmap temp = null;
ImageManager.IImage image = i < count ? images.getImageAt(i) : null; if (image != null) {
temp = image.miniThumbBitmap();
} if (temp != null) {
if (ImageManager.isVideo(image)) {
Bitmap newMap = temp.copy(temp.getConfig(), true);
Canvas overlayCanvas = new Canvas(newMap);
int overlayWidth = mVideoOverlay.getIntrinsicWidth();
int overlayHeight = mVideoOverlay.getIntrinsicHeight();
int left = (newMap.getWidth() - overlayWidth) / 2;
int top = (newMap.getHeight() - overlayHeight) / 2;
Rect newBounds = new Rect(left, top, left + overlayWidth, top + overlayHeight);
mVideoOverlay.setBounds(newBounds);
mVideoOverlay.draw(overlayCanvas);
temp.recycle();
temp = newMap;
} Bitmap temp2 = ImageLoader.transform(m, temp, imageWidth, imageHeight, true);
if (temp2 != temp)
temp.recycle();
temp = temp2;
} Bitmap thumb = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_8888);
Canvas tempCanvas = new Canvas(thumb);
if (temp != null)
tempCanvas.drawBitmap(temp, new Matrix(), new Paint());
mCellOutline.setBounds(0, 0, imageWidth, imageHeight);
mCellOutline.draw(tempCanvas); placeImage(thumb, c, pdpaint, imageWidth, padding, imageHeight, padding, offsetWidth, offsetHeight, i); thumb.recycle(); if (temp != null)
temp.recycle();
} return b;
}