1

In my android application I have a horizontal list view and a vertical one. The vertical view contains images. When any of the images is touched, it must go to the horizontal view, but every 3 of them must be drawn over each other in the same image view and shifted upwards so that all the images will appear.

Thanks

peak
  • 105,803
  • 17
  • 152
  • 177
user3419526
  • 13
  • 1
  • 4
  • It is much easier for us to help you if you try something first and if that doesn't work post what you tried and why it didn't work. "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results." - http://stackoverflow.com/help/on-topic – DanielBarbarian Mar 14 '14 at 11:20

1 Answers1

9

use this code for show 2 image in one image:

    ImageView myImageView = (ImageView) findViewById(R.id.img1);
    Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.call);
    Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.available);
    Bitmap combinedBitmap = getCombinedBitmap(pic2, pic1);

    myImageView.setImageBitmap(b);

and this is the getCombinedBitmap() method :

public Bitmap getCombinedBitmap(Bitmap b, Bitmap b2) {
    Bitmap drawnBitmap = null;

    try {
        drawnBitmap = Bitmap.createBitmap(200, 200, Config.ARGB_8888);

        Canvas canvas = new Canvas(drawnBitmap);
        // JUST CHANGE TO DIFFERENT Bitmaps and coordinates .
        canvas.drawBitmap(b, 0, 0, null);
        canvas.drawBitmap(b2, 0, 0, null);
        //for more images :
        // canvas.drawBitmap(b3, 0, 0, null);
        // canvas.drawBitmap(b4, 0, 0, null);

    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return drawnBitmap;
}

enjoy :)

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
Sadegh
  • 862
  • 1
  • 8
  • 23