Android how to create the stack kind of image backgrounds

╄→гoц情女王★ 提交于 2019-12-01 08:46:05

Place a your album thumb over a dummy image(which contains 2 or 3 images in diff allign).

I use bitmap to create the stack view and show it in a imageview. You can based on this to save the bitmap is resource then add it in the gridview or use it in gridview adapter in getView I think.

Bitmap m1c = BitmapFactory.decodeResource(getResources(), R.drawable.cat_13);
Bitmap m2c = BitmapFactory.decodeResource(getResources(), R.drawable.cat_13);


int w = m1c.getWidth();
int h = m1c.getHeight();

Matrix mtx = new Matrix();
mtx.postRotate(4);
Bitmap rotatedBMP = Bitmap.createBitmap(m1c, 0, 0, w, h, mtx, true);

Matrix mtx2 = new Matrix();
mtx2.postRotate(-4);

Bitmap rotatedBMP2 = Bitmap.createBitmap(m1c, 0, 0, w, h, mtx2, true);


Canvas comboImage = new Canvas(rotatedBMP);
comboImage.drawBitmap(rotatedBMP2, -10 , -10 , null);
comboImage.drawBitmap(m2c, 10 , 10 , null);

ImageView image = (ImageView) findViewById(R.id.imageView1);
image.setImageBitmap(rotatedBMP);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!