0

I want to make effect like attached image in android

enter image description here

Can any one help please?

Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175

2 Answers2

0

You can use this library for your problem:

A Code Example maybe look like this:

mageView mImageView;
PhotoViewAttacher mAttacher;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Any implementation of ImageView can be used!
    mImageView = (ImageView) findViewById(R.id.iv_photo);

    // Set the Drawable displayed
    Drawable bitmap = getResources().getDrawable(R.drawable.wallpaper);
    mImageView.setImageDrawable(bitmap);

    // Attach a PhotoViewAttacher, which takes care of all of the zooming functionality.
    mAttacher = new PhotoViewAttacher(mImageView);
}


// If you later call mImageView.setImageDrawable/setImageBitmap/setImageResource/etc then you just need to call
attacher.update();

Otherwise you can just read the documentation on Transition and Animation from Android Docs. There are even many examples.

Hicham
  • 67
  • 1
  • 2
  • 8
  • Thanks for your answer, but I don't need animation, I want to make a list view that take list of images and for each image it will draw a three layer view for the same image with different opacity values. – Amira Elsayed Ismail Oct 18 '15 at 08:57
0

I did it using the following method :)

public Bitmap getImageAlbumCover (Bitmap sourceBitmap) {

        Bitmap resultBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0,
                sourceBitmap.getWidth()-1, sourceBitmap.getHeight()-1);
        int padding = 15;
        int width = resultBitmap.getWidth();
        int height = resultBitmap.getHeight();

        Canvas canvas = new Canvas(resultBitmap);
        Rect srcRect = new Rect(0, 0, width, height);
        Rect desrect1 = new Rect((-1 * 1 * padding), (3 * padding) , width + (-1 * 1 * padding), height + (-1 * 3 * padding));
        Rect desrect2 = new Rect((-1 * 2 * padding), (2 * padding) , width + (-1 * 2 * padding), height + (-1 * 2 * padding));
        Rect desrect3 = new Rect((-1 * 3 * padding), (1 * padding) , width + (-1 * 3 * padding), height + (-1 * 1 * padding));



        Paint paint = new Paint();
        paint.setColor(Color.WHITE);
        canvas.drawRect(0, 0, width, height, paint);

        paint.setAlpha(64);

        canvas.drawBitmap(sourceBitmap, srcRect, desrect1, paint);

        paint.setAlpha(128);

        canvas.drawBitmap(sourceBitmap, srcRect, desrect2, paint);

        paint.setAlpha(255);

        canvas.drawBitmap(sourceBitmap, srcRect, desrect3, paint);

        return resultBitmap;
    }
Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175