Android how to create stack background type

I am developing an application where I need to create albums and display them in a GridView. Now I just show them without a background, but I need a background for the cover of the album so that it looks like a bunch of photos. Something like that:

enter image description here

I tried this but did not work:

I first created one background similar to this:

<shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#FFFFFF" /> <stroke android:width="1dp" android:color="#000000" /> <padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" /> </shape> 

And then I used a list of layers to draw a stack with rotation:

 <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <rotate android:drawable="@drawable/thumb_bg" android:fromDegrees="90" android:pivotX="50%" android:pivotY="50%" android:toDegrees="100" /> <rotate android:drawable="@drawable/thumb_bg" android:fromDegrees="90" android:pivotX="50%" android:pivotY="50%" android:toDegrees="110" /> <rotate android:drawable="@drawable/thumb_bg" android:fromDegrees="90" android:pivotX="50%" android:pivotY="50%" android:toDegrees="120" /> </layer-list> 
+3
android android-layout android-xml android-imageview
Feb 06 '13 at 11:01
source share
2 answers

Place your thumb on top of the dummy image (which contains 2 or 3 images in the diff dialog box).

0
Feb 06 '13 at 11:17
source share

I use a bitmap to create a stack view and show it in the image view. Based on this, you can save the bitmap - this is a resource, and then add it to the gridview or use it in the gridview adapter in getView, I think.

enter image description here

 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); 
0
Jul 12 '13 at 7:56
source share



All Articles